Commit e1c29074 authored by lipengcheng 's avatar lipengcheng

feat(vue.config.js): 优化打包去掉console配置

parent 290cf4a6
......@@ -35,6 +35,7 @@
"core-js": "^3.6.5",
"lodash": "^4.17.20",
"lodash-webpack-plugin": "^0.11.5",
"moment": "^2.27.0",
"register-service-worker": "^1.7.1",
"vue": "^2.6.11",
"vue-bus": "^1.2.1",
......
......@@ -22,17 +22,15 @@ module.exports = {
}
},
chainWebpack: (config) => {
if (process.env.NODE_ENV === 'production') {
// 按需引入lodash
config.plugin('lodashReplace').use(new LodashModuleReplacementPlugin())
// 生产环境打包去掉console
config.when(process.env.NODE_ENV !== 'development', (config) => {
// 生产环境打包去掉console
config.optimization.minimizer('terser').tap((options) => {
options[0].terserOptions.compress.drop_console = true
return options
})
// 按需引入lodash
config.plugin('lodashReplace').use(new LodashModuleReplacementPlugin())
})
}
config.module
.rule('eslint')
.use('eslint-loader')
......
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