-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
33 lines (32 loc) · 916 Bytes
/
webpack.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
const path = require('path');
const webpack = require('webpack');
module.exports = {
entry: {
app:path.join(__dirname, 'src'),
vendors: ['react','redux']
},
output: {
path: path.join(__dirname, 'dist'),
filename: '[name].js'
},
module: {
loaders: [
{
test:/\.js?$/,
exclude:/node_modules/,
loader:'babel',
query:{
presets:['react','es2015','stage-2']
}
}
]
},
plugins: [
// kills the compilation upon an error.
// this keeps the outputed bundle **always** valid
new webpack.NoErrorsPlugin(),
//这个使用uglifyJs压缩你的js代码
//new webpack.optimize.UglifyJsPlugin({minimize: true}),
new webpack.optimize.CommonsChunkPlugin('vendors', 'vendors.js'),
]
};