-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack-prod.config.js
48 lines (44 loc) · 1.21 KB
/
webpack-prod.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
var webpack = require('webpack');
var path = require('path');
var BUILD_DIR = path.resolve(__dirname, 'static/webpack');
var APP_DIR = path.resolve(__dirname, 'static/js');
//TODO: add instructions about how to setup webpack into README
//./node_modules/webpack/bin/webpack.js -p --config ./webpack-prod.config.js - add this to build script
var config = {
context: APP_DIR,
entry:{
bundle: [APP_DIR + '/index.jsx']
},
output: {
path: BUILD_DIR,
filename: 'bundle.js'
},
plugins: [
new webpack.optimize.CommonsChunkPlugin('common.js'),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.UglifyJsPlugin(),
new webpack.optimize.AggressiveMergingPlugin(),
new webpack.DefinePlugin({
"process.env": {
NODE_ENV: JSON.stringify("production")
}
})
],
module: {
loaders: [
{
test: /.jsx?$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: {
presets: [{
plugins: ['transform-class-properties']
}, 'react', 'es2015', 'stage-0']
}
}
]
}
};
module.exports = config;/**
* Created by yura on 11/2/16.
*/