A Rollup plugin to minify the generated bundle with Terser.
This is a complete rewrite of TrySound/rollup-plugin-terser.
Main differences:
- the code is written in TypeScript;
- this plugin supports both Rollup 2 and Rollup 3;
- the implementation is more lightweight and probably less resource-consuming, but it does not use workers (therefore, it could be slower).
npm i -D @wwa/rollup-plugin-terserimport { rollup } from 'rollup';
import { terser } from '@wwa/rollup-plugin-terser';
rollup({
input: 'file.js',
plugins: [
terser(),
],
});terser accepts an optional options parameter, which is the MinifyOptions object.
The plugin automatically sets the following options:
module: trueif the output format isesmores;toplevel: trueif the output format iscjs;sourcemapis always inferred from rollup's options.