Commit 290cf4a6 authored by lipengcheng 's avatar lipengcheng

feat: 生产环境打包去掉console

parent 629e31f0
...@@ -23,21 +23,15 @@ module.exports = { ...@@ -23,21 +23,15 @@ module.exports = {
}, },
chainWebpack: (config) => { chainWebpack: (config) => {
if (process.env.NODE_ENV === 'production') { if (process.env.NODE_ENV === 'production') {
// 按需引入lodash
config.plugin('lodashReplace').use(new LodashModuleReplacementPlugin()) config.plugin('lodashReplace').use(new LodashModuleReplacementPlugin())
// 生产环境打包去掉console
// // 去除 console.log config.when(process.env.NODE_ENV !== 'development', (config) => {
// config.plugin('uglify').tap(([options]) => { config.optimization.minimizer('terser').tap((options) => {
// return [ options[0].terserOptions.compress.drop_console = true
// Object.assign(options, { return options
// uglifyOptions: { })
// compress: { })
// drop_console: true,
// pure_funcs: ['console.log']
// }
// }
// })
// ]
// })
} }
config.module config.module
.rule('eslint') .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