I’m using React with webpack, and now trying a production configuration that includes uglification, comment stripping to start.
My webpack.config.js
module.exports
includes
optimization: {
minimizer: [
new UglifyJsPlugin({
uglifyOptions: {
output: {
comments: false,
},
},
}),
],
},
but using that with webpack --mode production
(it’s ignored for --mode development
) just gets me some obscure error
ERROR in main.js from UglifyJs
Unexpected token: name «texts», expected: punc «;» [main.js:1273,6]
error Command failed with exit code 2.
I’m a bit lost in this big webpack world, clearly, and anyone with a working uglification configuration would be helpful to hear from.
Eventually, I’d like to turn on name mangling, etc., to protect intellectual property, etc.