https://github.com/guoyunhe/swc-minify-webpack-plugin
A faster minimizer for webpack based on swc.minify()
https://github.com/guoyunhe/swc-minify-webpack-plugin
minimizer swc webpack webpack-plugin
Last synced: about 1 year ago
JSON representation
A faster minimizer for webpack based on swc.minify()
- Host: GitHub
- URL: https://github.com/guoyunhe/swc-minify-webpack-plugin
- Owner: guoyunhe
- License: apache-2.0
- Created: 2022-03-22T15:06:26.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-08-22T09:51:04.000Z (almost 2 years ago)
- Last Synced: 2025-05-19T22:28:43.970Z (about 1 year ago)
- Topics: minimizer, swc, webpack, webpack-plugin
- Language: TypeScript
- Homepage:
- Size: 166 KB
- Stars: 9
- Watchers: 2
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# SwcMinifyWebpackPlugin
Faster minimizer plugin for webpack based on `swc.minify()`.
This plugin is forked from [swc-webpack-plugin](https://github.com/ice-lab/swc-webpack-plugin), with following differences:
- Simpiler options
- Use `swc.minify()` instead of `swc.transform()`, for better performance
- enable `mangle` by default for better compression rate
This plugin is faster than [terser-webpack-plugin's swc mode](https://webpack.js.org/plugins/terser-webpack-plugin/#swc).
## Install
```
npm i -D swc-minify-webpack-plugin
```
## Usage
Recommended configuration:
```js
// webpack.config.js
const { SwcMinifyWebpackPlugin } = require('swc-minify-webpack-plugin');
module.exports = {
optimization: {
minimize: true,
minimizer: [new SwcMinifyWebpackPlugin()],
},
};
```
Custom configuration:
```js
// webpack.config.js
const { SwcMinifyWebpackPlugin } = require('swc-minify-webpack-plugin');
module.exports = {
optimization: {
minimize: true,
minimizer: [
new SwcMinifyWebpackPlugin({
compress: false,
mangle: true,
}),
],
},
};
```
## Options
### `compress`
Type: `boolean | object`
Default: `true`
See
### `mangle`
Type: `boolean | object`
Default: `true`
See
### `format`
Type: `object`
See