Is there a way to call the UglifyJS2 API in a node script (ie by calling require('uglify-js').minify
) on a string of code such that it removes dead/unreachable code but does not apply any compression
For example:
var foo = 'bar';
if (false) {
foo = 'yo';
}
alert('Foo value found');
alert(foo);
Would become
var foo = 'bar';
alert('Foo value found');
alert(foo);
Very late answer, but compress: {defaults: false, dead_code: true, unused: true}
will work in Terser. See docs.
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