Commit 290cf4a6 authored by lipengcheng 's avatar lipengcheng

feat: 生产环境打包去掉console

parent 629e31f0
......@@ -23,21 +23,15 @@ module.exports = {
},
chainWebpack: (config) => {
if (process.env.NODE_ENV === 'production') {
// 按需引入lodash
config.plugin('lodashReplace').use(new LodashModuleReplacementPlugin())
// // 去除 console.log
// config.plugin('uglify').tap(([options]) => {
// return [
// Object.assign(options, {
// uglifyOptions: {
// compress: {
// drop_console: true,
// pure_funcs: ['console.log']
// }
// }
// })
// ]
// })
// 生产环境打包去掉console
config.when(process.env.NODE_ENV !== 'development', (config) => {
config.optimization.minimizer('terser').tap((options) => {
options[0].terserOptions.compress.drop_console = true
return options
})
})
}
config.module
.rule('eslint')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment