标签:logs web 推荐 res console drop 插件 div 配置
Webpack 默认提供的 UglifyJS 插件,由于采用单线程压缩,速度颇慢 ;推荐采用 webpack-parallel-uglify-plugin 插件,其做法如下,
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
},
sourceMap: true
})
替换如上自带的 UglifyJsPlugin 写法为如下配置即可:
var ParallelUglifyPlugin = require(‘webpack-parallel-uglify-plugin‘);
new ParallelUglifyPlugin({
cacheDir: ‘.cache/‘,
uglifyJS:{
output: {
comments: false
},
compress: {
warnings: false
}
}
})
在压缩插件里过滤掉即可,加后的代码如下:
new ParallelUglifyPlugin({
cacheDir: ‘.cache/‘,
uglifyJS:{
output: {
comments: false
},
compress: {
warnings: false,
drop_console: true,
pure_funcs: [‘console.log‘]
}
}
})
标签:logs web 推荐 res console drop 插件 div 配置
原文地址:http://www.cnblogs.com/liuhuanwen/p/7878487.html