安装依赖
npm install uglifyjs-webpack-plugin --save-dev
webpack配置
chainWebpack: (config)=>{
// 去除console
config
.plugin('uglifyjs-plugin')
.use('uglifyjs-webpack-plugin', [{
uglifyOptions: {
warnings: false,
compress: {
drop_console: true,
drop_debugger: false,
pure_funcs: ['console.log']
}
}
}])
}
网友评论