-
Notifications
You must be signed in to change notification settings - Fork 15
/
webpack.production.config.js
42 lines (39 loc) · 1.31 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
var webpack = require('webpack');
var webpackDefaultConfig=require("./webpack.config");
var PRODUCT_CONFIG = {
module:{
loaders: [
{
test: /\.(png|jpg|svg|gif)$/,
loader: 'url?limit=20480&name=[name]-[hash:8].[ext]'//20k
},
{
test: /\.(ttf|eot|svg|woff[1-9]?)$/,
loader: "file?name=../fonts/[name]-[hash:8].[ext]"
},
{
test: /\.jpeg?$/,
loader: 'file?name=[name]-[hash:8].[ext]'//20k
}
]
},
plugins: [
new webpack.optimize.OccurenceOrderPlugin(true),
//js压缩参数
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false,
drop_console: true
},
beautify:false,
comments:false
}),
//定义环境变量production,定义后就不不把提示的东西打包进去
new webpack.DefinePlugin({
'process.env': {NODE_ENV: '"production"'}
})
]
};
webpackDefaultConfig.module.loaders=PRODUCT_CONFIG.module.loaders.concat(webpackDefaultConfig.module.loaders);
webpackDefaultConfig.plugins=webpackDefaultConfig.plugins.concat(PRODUCT_CONFIG.plugins);
module.exports = webpackDefaultConfig;