{"id":20600,"library":"swc-webpack-plugin","title":"swc-webpack-plugin","description":"A webpack plugin that minifies bundles using swc, a fast Rust-based JS/TS minifier. Version 1.0.0 is the current stable release. It integrates as a custom minimizer in webpack's optimization pipeline, offering a synchronous mode option. Key differentiators: leverages swc's speed (often faster than Terser), supports all swc configuration options, and works with webpack 4 and 5. Ships TypeScript types.","status":"active","version":"1.0.0","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/soulwu/swc-webpack-plugin","tags":["javascript","swc","webpack","plugin","minify","typescript"],"install":[{"cmd":"npm install swc-webpack-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add swc-webpack-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add swc-webpack-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency: required at runtime for minification","package":"@swc/core","optional":false},{"reason":"peer dependency: required as the build system","package":"webpack","optional":false}],"imports":[{"note":"Named export, not default. CJS users must destructure require.","wrong":"const SWCMinifyPlugin = require('swc-webpack-plugin')","symbol":"SWCMinifyPlugin","correct":"import { SWCMinifyPlugin } from 'swc-webpack-plugin'"},{"note":"CJS destructure directly from require.","wrong":"const SWCMinifyPlugin = require('swc-webpack-plugin').default","symbol":"SWCMinifyPlugin","correct":"const { SWCMinifyPlugin } = require('swc-webpack-plugin')"},{"note":"If you need to type options, import the type. Not all users need this.","symbol":"SWCMinifyPlugin type","correct":"import { type SWCMinifyPluginOptions } from 'swc-webpack-plugin'"}],"quickstart":{"code":"const { SWCMinifyPlugin } = require('swc-webpack-plugin');\nconst path = require('path');\n\nmodule.exports = {\n  entry: './src/index.js',\n  output: {\n    path: path.resolve(__dirname, 'dist'),\n    filename: 'bundle.js',\n  },\n  optimization: {\n    minimize: true,\n    minimizer: [new SWCMinifyPlugin()],\n  },\n};","lang":"javascript","description":"Adds swc minification to a webpack config by replacing the default minimizer with SWCMinifyPlugin."},"warnings":[{"fix":"Check plugin documentation for supported options. Use @swc/core directly for full control.","message":"swc-webpack-plugin does not support all swc options; some may be ignored or cause errors.","severity":"gotcha","affected_versions":"<1.0.0"},{"fix":"Upgrade Node.js to >=14 or higher.","message":"Node.js >=10 is deprecated; consider upgrading for security and compat.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Ensure @swc/core is at least 1.2.0.","message":"Peer dependency @swc/core ^1.2.0 required; older versions may break.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Test thoroughly; consider webpack 5.","message":"The plugin may not work with webpack 4 if certain features are missing.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install --save-dev @swc/core' to install peer dependency.","cause":"@swc/core not installed or not resolved.","error":"Module not found: Error: Can't resolve '@swc/core'"},{"fix":"Use const { SWCMinifyPlugin } = require('swc-webpack-plugin');","cause":"CJS destructure not used; imported default instead of named export.","error":"TypeError: SWCMinifyPlugin is not a constructor"},{"fix":"Run 'npm install --save-dev swc-webpack-plugin' and check spelling.","cause":"Package not installed or typo in import.","error":"Error: Cannot find module 'swc-webpack-plugin'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}