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-swc3Verified import paths — ran on the pinned version, not inferred.
Basic Rollup config using swcPlugin to transpile TypeScript to ES2020 and minify output.
Upgrade Node.js to >=16
Review decorator settings; set jsc.parser.decorators explicitly if needed.
Use import { preserveDirectives } from 'rollup-preserve-directives' instead.Ensure all source files are covered by include option, or set include to ['**/*.ts'].
Change to import { swcPlugin } from 'rollup-plugin-swc3'Provide a valid tsconfig path: swcPlugin({ tsconfig: 'tsconfig.json' })Run npm install @swc/core --save
Upgrade Rollup: npm install rollup@latest