vue打包后去掉debugger和console

在vue.config中

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"

    ];

}}

你可能感兴趣的:(vue打包后去掉debugger和console)