Rollup plugin to minify generated bundle.
npm i rollup-plugin-uglify -D
options – default:
object. UglifyJS API options
minifier – default:
function. Module to use as a minifier. You can use other versions (or forks) of UglifyJS instead default one.
UglifyJS, which this plugin is based on, does not support the ES2015 module syntax. Thus using this plugin with Rollup's default bundle format (
'es') will not work and error out.
To work around this you can tell
rollup-plugin-uglify to use the UglifyJS unstable es version by passing its
minify function to minify your code.
To install the experimental version of UglifyJS:
npm i uglify-es -D
If you'd like to preserve comments (for licensing for example), then you can specify a function to do this like so:
See UglifyJS documentation for further reference.
MIT © Bogdan Chadkin