Currently in my Vue CLI 3 setup, I'm encountering an issue with implementing the Terser Webpack Plugin to remove console.log and comments from the code. Despite following the production workflow below:
- Execute
npm run build
- Run
serve -s dist
vue.config.js:
module.exports = {
publicPath: "./"
}
webpack.config.js:
const TerserPlugin = require('terser-webpack-plugin');
module.exports = {
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
terserOptions: {
ecma: undefined,
warnings: false,
parse: {},
compress: { drop_console: true },
mangle: true, // Note `mangle.properties` is `false` by default.
module: false,
output: { comments: false },
toplevel: false,
nameCache: null,
ie8: false,
keep_classnames: undefined,
keep_fnames: false,
safari10: false,
},
}),
],
},
};
package.json:
{
"name": "cli3pwavuetify",
"version": "0.1.0",
"private": true,
...
}
What modifications should be made for it to function properly? Is webpack.config.js
the correct location for these changes?