vue-cli配置webpack清除生产环境console输出的信息

1,309 阅读1分钟

build/webpack.prod.conf.js文件下的plugins添加插件webpack.optimize.UglifyJsPlugin

new webpack.optimize.UglifyJsPlugin({
    compress: {
        warnings: false,
        drop_debugger: true, //自动删除debugger
        drop_console: true //自动删除console.log
    },
    sourceMap: true
}),

重新打包项目,就会看到清除效果。