Closed joecorkerton closed 6 years ago
@joecorkerton create two instance of plugin and put second instance after first
@evilebottnawi and if I include:
with the same string it will figure out to apply the second uglify to the already transformed code? Intuitively it seems like that it would not figure that out
Otherwise what should I do instead of the second include
?
@joecorkerton just use:
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
module.exports = {
//...
optimization: {
minimizer: [new UglifyJsPlugin(), new UglifyJsPlugin()]
}
};
You can define own options, also you can exclude/include chunks what should be do not uglify twice
@evilebottnawi Thanks for your help so far.
I have been playing around with different config options and it seems like I'm not able to disable mangle now. I set mangle to false and the output is still minified, with the same filesize. This seems to be the same issue as #234 . Is there a solution for that? Reading through the issue didn't help much
@joecorkerton please create minimum reproducible test repo and describe what you have and what you expected, i can't understand you
uglifyjs elm.js --compress 'pure_funcs="F2,F3,F4,F5,F6,F7,F8,F9,A2,A3,A4,A5,A6,A7,A8,A9",pure_getters=true,keep_fargs=false,unsafe_comps=true,unsafe=true,passes=2' --output=elm.js && uglifyjs elm.js --mangle --output=elm.js
Elm is doing that to work around a bug in uglify-js
.
See https://github.com/parcel-bundler/parcel/issues/2062#issuecomment-424763767 for the correct way to do it in both Terser and Uglify.
minimizer: [new UglifyJsPlugin(), new UglifyJsPlugin()]
That's inefficient - that would parse and output the code twice.
Instead just set the compress
option passes
to 2 or greater.
Is it possible to apply uglify twice to the same code? I need to do the webpack equivalent of
Why?