A webpack plugin that uses swc.minify() to minify JavaScript bundles, offering faster performance than terser-webpack-plugin's swc mode. Current stable version is 2.1.3, released under Apache 2.0 license. It provides simpler options, enables mangle by default for better compression, and is a fork of swc-webpack-plugin with improved performance by using swc.minify() instead of swc.transform(). Requires webpack 5+ and @swc/core 1+ as peer dependencies. Ships TypeScript type definitions.
npm install swc-minify-webpack-pluginVerified import paths — ran on the pinned version, not inferred.
Basic usage of swc-minify-webpack-plugin as the sole minimizer in webpack's optimization configuration.
Change `import SwcMinifyWebpackPlugin from 'swc-minify-webpack-plugin'` to `import { SwcMinifyWebpackPlugin } from 'swc-minify-webpack-plugin'`Upgrade to v2 and use named export.
Refer to swc documentation for valid options: https://swc.rs/docs/configuration/minification
Run `npm install -D swc-minify-webpack-plugin` and ensure import uses require or import correctly.
Use named import: `import { SwcMinifyWebpackPlugin } from 'swc-minify-webpack-plugin'`Check options: only `compress`, `mangle`, and `format` are supported. Pass them as an object: `new SwcMinifyWebpackPlugin({ compress: false })`