Rollup plugin to minify generated bundles using swc. Version 1.3.0 supports Rollup ^2, ^3, or ^4 and requires Node.js >= 14.18. It focuses solely on minification, making it simpler than rollup-plugin-swc which does transpilation. It is benchmarked to be faster than @rollup/plugin-terser. Provides options for format, sourcemap, and sourcemapExcludeSources. Licensed under MIT.
npm install rollup-plugin-swc-minifyVerified import paths — ran on the pinned version, not inferred.
Minifies the bundle with swc, supporting ES module format and sourcemaps.
Use import statements or dynamic import() instead of require().
Use rollup-plugin-swc for transpilation before minification.
Set rollup output.format appropriately (e.g., 'es') and optionally pass format to minify() for accurate minification.
Set sourcemap: true and control source map content via Rollup options if possible.
Run `npm install -D rollup-plugin-swc-minify` and ensure rollup version is ^2 || ^3 || ^4.
Use the named import: `import { minify } from 'rollup-plugin-swc-minify'`.Use `import` instead of `require()`, or set type: 'module' in package.json.
Use `minify()` (call the function) instead of `new minify()` or just `minify`.