vue webpack 去掉打包注释
安装 uglifyjs-webpack-plugin
npm install uglifyjs-webpack-plugin --save-dev
vue.config.js
const UglifyJsPlugin = require('uglifyjs-webpack-plugin') //引入插件
configureWebpack: {
// provide the app's title in webpack's name field, so that
// it can be accessed in index.html to inject the correct title.
optimization: {
minimizer: [
new UglifyJsPlugin({
uglifyOptions: {
// 删除注释
output: {
comments: false
},
// 删除console debugger 删除警告
compress: {
drop_console: true, //console
drop_debugger: false,
pure_funcs: ['console.log'] //移除console
}
}
})
]
}
},