I am using the terser webpack plugin. I tried with this configuration.
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
terserOptions: {
output: {
comments: false,
},
},
}),
],
But still, it outputs a .LICENSE file. How to build the code without comments.
Should be
new TerserPlugin({
extractComments: false,
})
see https://github.com/webpack-contrib/terser-webpack-plugin#extractcomments
The docs also give an example for "if you avoid building with comments":
module.exports = {
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
terserOptions: {
format: {
comments: false,
},
},
extractComments: false,
}),
],
},
};
Note: Both the extractComments: false and terserOptions: { format: { comments: false } } options are used.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With