Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

rollup-plugin-swc-minify

prantlf212MIT1.2.0

Rollup plugin to minify generated bundles using swc.

rollup, plugin, rollup-plugin, minify, swc

readme

rollup-plugin-swc-minify

Latest version Dependency status Coverage

Rollup plugin to minify generated bundles using swc.

Simpler than rollup-plugin-swc, focusing only on minification of the bundled JavaScript output. Faster than @rollup/plugin-terser. See also benchmark results of various minifiers.

Synopsis

import { minify } from 'rollup-plugin-swc-minify'

export default {
  plugins: [minify()]
  // the rest of the configuration
}

Installation

Make sure that you use Node.js 14 or newer and Rollup 2 or newer. Use your favourite package manager - NPM, PNPM or Yarn:

npm i -D rollup-plugin-swc-minify
pnpm i -D rollup-plugin-swc-minify
yarn add -D rollup-plugin-swc-minify

Usage

Create a rollup.config.js configuration file and import the plugin:

import { minify } from 'rollup-plugin-swc-minify'

export default {
  input: 'src/index.js',
  output: { file: 'dist/main.js', format: 'iife', sourcemap: true },
  plugins: [
    minify()
  ]
}

Then call rollup either via the command-line or programmatically.

Options

  • format - if set to 'es', the code will be minified as an ES module
  • sourcemap - set to true to generate a source map
  • sourcemapExcludeSources - set to true to not include a copy of sources in the source map

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Lint and test your code.

License

Copyright (C) 2022-2024 Ferdinand Prantl

Licensed under the MIT License.

changelog

Changes

1.2.0 (2024-12-10)

Features

1.1.2 (2024-08-06)

Bug Fixes

1.1.1 (2024-05-26)

Bug Fixes

1.1.0 (2023-10-08)

Features

  • Recognise the option sourcemapExcludeSources and upgrade swc (b076c7b)

1.0.6 (2023-04-23)

Bug Fixes

1.0.5 (2022-10-30)

Bug Fixes

  • Upgrade dependencies, support Rollup 3 (b6d3ab2)

1.0.4 (2022-08-01)

Bug Fixes

1.0.3 (2022-06-18)

Bug Fixes

1.0.2 (2022-06-03)

Bug Fixes

1.0.1 (2022-05-19)

Bug Fixes

  • Remove lit from peer deps (eafd455)

1.0.0 (2022-05-18)

Initial release