用 UglifyJsPlugin 可以正常打包,就是很慢
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
},
sourceMap: true
}),
用 ParallelUglifyPlugin 加速打包之后
new ParallelUglifyPlugin({
cacheDir: '.cache/',
uglifyJS: {
output: {
comments: false
},
compress: {
warnings: false
}
},
sourceMap: config.build.productionSourceMap
}),
打包失败,报错
ERROR in Encountered an error while minifying static/js/0.feb0ac937597219abdc1.js:
`warnings` is not a supported option
将: compress: { warnings: false } 改为: warnings: false
new ParallelUglifyPlugin({
cacheDir: '.cache/',
uglifyJS:{
output: {
comments: false
},
warnings: false,
compress: {
drop_debugger: true,
drop_console: true
}
}
}),