Registry / devops / rollup-plugin-swc3

rollup-plugin-swc3

JSON →
library0.12.1jsnpmunverified

Rollup plugin that uses SWC (a Rust-based transpiler) for fast ESNext/TypeScript compilation. Version 0.12.1 is current (released Oct 2023), targeting Node >=16 with peer deps on @swc/core >=1.2.165 and Rollup 2/3/4. Differentiators vs other SWC Rollup plugins: built-in minification (swcMinify), tsconfig/jsconfig reading, viteMinify helper, ESM-only exports, and TypeScript declarations. Actively maintained with frequent releases. Replaces rollup-plugin-typescript2, @rollup/plugin-typescript, and @rollup/plugin-babel.

npm install rollup-plugin-swc3
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-SWC3
R
rollup-plugin-swc3
devopsjavascriptv0.12.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

swcPlugin
import { swcPlugin } from 'rollup-plugin-swc3'
import swcPlugin from 'rollup-plugin-swc3'
Named export, not default. ESM-only package; CommonJS not supported.
swcMinify
import { swcMinify } from 'rollup-plugin-swc3'
Named export for minification plugin in Rollup.
viteMinify
import { viteMinify } from 'rollup-plugin-swc3'
import { viteMinify } from 'rollup-plugin-swc3'
Available since 0.11.2; disables Vite's built-in minification.

Basic Rollup config using swcPlugin to transpile TypeScript to ES2020 and minify output.

import { swcPlugin } from 'rollup-plugin-swc3'; export default { input: 'src/index.ts', output: { dir: 'dist', format: 'esm' }, plugins: [ swcPlugin({ tsconfig: 'tsconfig.json', minify: true, jsc: { target: 'es2020', parser: { syntax: 'typescript', decorators: true } } }) ] };
Debug
Known issues
breakingMinimum Node version bumped from 12 to 16 in 0.12.0
fix
Upgrade Node.js to >=16
affects: >=0.12.0
breakingDecorator detection changed in 0.12.0: TypeScript 5 enables 2022-03 decorators automatically; older TS uses experimentalDecorators from tsconfig.
fix
Review decorator settings; set jsc.parser.decorators explicitly if needed.
affects: >=0.12.0
deprecatedpreserveUseDirective export deprecated since 0.9.1; replaced by standalone rollup-preserve-directives plugin.
fix
Use import { preserveDirectives } from 'rollup-preserve-directives' instead.
affects: >=0.9.1
gotchaModule resolution only applies to files within include/exclude patterns (since 0.11.0).
fix
Ensure all source files are covered by include option, or set include to ['**/*.ts'].
affects: >=0.11.0
Errors
Common errors & fixes
TypeError: (0 , rollup_plugin_swc3.swcPlugin) is not a function
Default import used instead of named import.
fix
Change to import { swcPlugin } from 'rollup-plugin-swc3'
Error: The 'tsconfig' option expects a string, got undefined
Missing or misspelled tsconfig option.
fix
Provide a valid tsconfig path: swcPlugin({ tsconfig: 'tsconfig.json' })
Error: Cannot find module '@swc/core'
@swc/core not installed or is a devDependency not available at runtime.
fix
Run npm install @swc/core --save
Error: rollup-plugin-swc3 requires Rollup >=2.0.0
Incompatible Rollup version (e.g., 1.x).
fix
Upgrade Rollup: npm install rollup@latest
Upgrade
Version history
0.12.1latest on npm
Audit
Dependencies
@swc/corerequiredRuntime dependency: used to perform actual transpilation and minification.
rolluprequiredPeer dependency: plugin integrates with Rollup bundler.
Agent activity
6 hits · last 30 days
node
6
Resources
rollup-plugin-swc3 — npm install rollup-plugin-swc3 · libregistry