yarn add rollup-plugin-terser --dev
Note: this package requires email@example.com and higher (including firstname.lastname@example.org)
⚠️ Caveat: any function used in options object cannot rely on its surrounding scope, since it is executed in an isolated context.
options - terser API options
Generates source maps and passes them to rollup. Defaults to
Amount of workers to spawn. Defaults to the number of CPUs minus 1.
If you'd like to preserve comments (for licensing for example), then you can specify a function to do this like so:
Alternatively, you can also choose to keep all comments (e.g. if a licensing header has already been prepended by a previous rollup plugin):
See Terser documentation for further reference.
MIT © Bogdan Chadkin