-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.production.config.js
49 lines (41 loc) · 1.09 KB
/
webpack.production.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
var path = require('path');
var webpack = require('webpack');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var nodeDir = path.resolve(__dirname, 'node_modules');
var postcss = require('postcss-loader');
var autoprefixer = require('autoprefixer');
var production = {
devtool: 'sourcemap',
entry: path.resolve(__dirname, 'src/index.js'),
output: {
pathinfo: false,
path: path.resolve(__dirname, 'dist'),
filename: "main.js",
},
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: [nodeDir],
loader: 'babel',
},
{
test: /\.s(a|c)ss$/,
loader: ExtractTextPlugin.extract("css?importLoaders=2!postcss!sass"),
}
]
},
postcss: [
autoprefixer({ browsers: ['last 2 versions'] }),
],
plugins: [
new ExtractTextPlugin('style.css', { allChunks : false }),
new webpack.optimize.DedupePlugin(),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV' : JSON.stringify('production')
}
}),
]
}
module.exports = production;