Skip to content
Home / Migrations / BabelSWC

Babel SWC

easy

SWC is 20-70x faster than Babel for transpilation. Drop-in replacement for most projects. No plugins needed for TypeScript/JSX.

Estimated: 1-2h · 5 steps
Progress0%
Step 1: Install SWC
npm install -D @swc/core @swc/cli && npm uninstall @babel/core @babel/preset-env @babel/preset-typescript @babel/preset-react
Step 2: Create .swcrc

SWC config is simpler than Babel. One file for TypeScript + React.

{
  "jsc": { "parser": { "syntax": "typescript", "tsx": true }, "target": "es2020" },
  "module": { "type": "commonjs" }
}
Step 3: Update build scripts

Replace babel with swc in package.json scripts. Jest: use @swc/jest transform.

npm install -D @swc/jest
Step 4: Check custom Babel plugins

If you used babel-plugin-* beyond basic transforms, check SWC plugin compatibility. Most popular plugins have equivalents.

Step 5: Verify
Build succeeds, tests pass, output is equivalent to Babel