But the solution’s not beautiful 🙈
There’s a bug with uglify-es
, which requires using the following in your package.json to force dependencies to use this version:
"resolutions": {
"uglify-es": "3.3.9"
},
But that will enable the following to work:
// vue.config.js
const UglifyJSPlugin = require('uglifyjs-webpack-plugin')
module.exports = {
configureWebpack: config => {
if (process.env.NODE_ENV === 'production') {
// mutate config for production...
config.optimization.minimizer = [
new UglifyJSPlugin({
uglifyOptions: {
compress: {
drop_console: true,
}
}
})
]
}
}
}
And voíla; no more `console.log` in production with the latest vue CLI service