赞
踩
一、vue生产环境去掉debugger和console
npm install terser-webpack-plugin -D
二、在vue.config.js文件里添加插件的配置
configureWebpack: config => {
if (process.env.NODE_ENV === 'production') {
config.optimization.minimizer[0].options.terserOptions.compress.warnings = false
config.optimization.minimizer[0].options.terserOptions.compress.drop_console = true
config.optimization.minimizer[0].options.terserOptions.compress.drop_debugger = true
config.optimization.minimizer[0].options.terserOptions.compress.pure_funcs = ['console.log']
}
},
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。