-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.product.js
More file actions
29 lines (26 loc) · 841 Bytes
/
Copy pathwebpack.product.js
File metadata and controls
29 lines (26 loc) · 841 Bytes
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
const webpack = require('webpack');
const merge = require('webpack-merge');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const commonConfig = require('./webpack.config.js');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
const publicConfig = {
devtool: 'cheap-module-source-map',
plugins: [
//清除dist文件夹
new CleanWebpackPlugin(['dist']),
//压缩js
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}),
//显示打包具体信息(包含各个模块的比重)
new BundleAnalyzerPlugin({
analyzerMode: 'server',
analyzerHost: '0.0.0.0',
analyzerPort: 8080
})
]
};
module.exports = merge(commonConfig, publicConfig);