Last Updated: November 21, 2025
SWC
Fast TypeScript/JavaScript compiler
Core Features
| Item | Description |
|---|---|
Rust-based
|
20x faster than Babel |
TypeScript
|
Native TypeScript support |
JSX/TSX
|
React transformation |
Minification
|
Built-in minifier |
Source Maps
|
Generate source maps |
Plugin System
|
Extensible via Rust/WASM |
Configuration
// .swcrc
{
"jsc": {
"parser": {
"syntax": "typescript",
"tsx": true
},
"transform": {
"react": {
"runtime": "automatic"
}
},
"target": "es2020"
},
"module": {
"type": "es6"
}
}
Common Commands
npm install -D @swc/core
Install SWC
npx swc src -d dist
Compile directory
npx swc file.ts -o output.js
Compile single file
Best Practices
- Use as Babel replacement for faster builds
- Integrate with Next.js, Vite, or webpack
- Enable minification for production
- Use with testing frameworks like Jest
💡 Pro Tips
Quick Reference
SWC is 20x faster than Babel for transpilation