SWC — Super-Fast Rust-Based JavaScript and TypeScript Compiler
SWC is an extensible Rust-based platform for the next generation of fast developer tools. It can be used for both compilation and bundling, offering 20x faster performance than Babel while maintaining compatibility with its ecosystem.
Installation agent prête
Cet actif peut être installé après choix du runtime, vérification du plan et exécution de la commande adaptée.
npx -y tokrepo@latest install e92c8526-366b-11f1-9bc6-00163e2b0d79 --target codexÀ exécuter après confirmation du plan en dry-run.
What it is
SWC (Speedy Web Compiler) is an extensible Rust-based platform for next-generation JavaScript tooling. It handles transpilation (ES2025 to ES5), TypeScript stripping, JSX transformation, bundling, and minification. SWC powers the build pipelines of Next.js, Deno, and Parcel.
SWC targets frontend engineers and toolchain maintainers who need faster builds without sacrificing Babel-level configurability.
The project is actively maintained with regular releases and a growing user community. Documentation covers common use cases, and the open-source nature means you can inspect the source code, contribute fixes, and adapt the tool to your specific requirements.
How it saves time or tokens
SWC replaces Babel in most build pipelines. Because it is written in Rust and uses parallel processing, compilation runs 20x faster on multi-core machines. For a large monorepo with thousands of TypeScript files, this cuts CI build times from minutes to seconds. No configuration changes are needed if you are already using a Babel-compatible preset.
How to use
- Install SWC as a dev dependency in your project.
- Create a
.swcrcconfiguration file or pass options via CLI flags. - Run
npx swc src -d distto compile your source directory.
Example
# Install SWC
npm install -D @swc/cli @swc/core
# Compile a directory
npx swc src -d dist
# Compile with watch mode
npx swc src -d dist --watch
// .swcrc
{
"jsc": {
"parser": {
"syntax": "typescript",
"tsx": true
},
"target": "es2020"
},
"module": {
"type": "es6"
}
}
Related on TokRepo
- AI Tools for Coding -- Developer tools and compiler utilities
- Featured Workflows -- Discover top-rated workflows on TokRepo
Common pitfalls
- SWC does not perform type checking. You still need
tsc --noEmitin your CI pipeline for type safety. - Some Babel plugins have no SWC equivalent. Check the SWC plugin registry before migrating complex Babel configs.
- The
.swcrcfile must be valid JSON, not JSON5. Trailing commas or comments will cause parse errors.
Before adopting this tool, evaluate whether it fits your team's existing workflow. Read the official documentation thoroughly, and start with a small proof-of-concept rather than a full migration. Community forums, GitHub issues, and Stack Overflow are valuable resources when you encounter edge cases not covered in the documentation.
Questions fréquentes
SWC is approximately 20x faster than Babel on single-threaded benchmarks and even faster with parallel processing enabled. The speed comes from being written in Rust with zero-copy parsing and efficient memory management.
Yes. SWC strips TypeScript types and transpiles TypeScript syntax to JavaScript. It supports TSX, decorators, and path aliases. However, it does not perform type checking -- you still need the TypeScript compiler for that.
For most projects, yes. SWC supports the common Babel presets (env, react, typescript). Some specialized Babel plugins may not have SWC equivalents, so check the SWC plugin ecosystem before migrating.
Next.js uses SWC as its default compiler since version 12. Deno uses SWC for TypeScript transpilation. Parcel v2 uses SWC for JavaScript transformation. Rspack also relies on SWC internally.
Yes. SWC includes an experimental bundler called swcpack. For production bundling, most teams pair SWC with a dedicated bundler like Webpack, Rspack, or Turbopack, using SWC as the transpilation layer.
Sources citées (3)
- SWC GitHub— SWC is an extensible Rust-based platform for fast developer tools
- Next.js Documentation— Next.js uses SWC as its default compiler
- SWC Documentation— SWC transpilation and configuration options
En lien sur TokRepo
Fil de discussion
Actifs similaires
Innernet — Simplified WireGuard Mesh Networking
Innernet is a tool for managing private WireGuard-based mesh networks with a central coordination server, CIDR-based access control, and automatic peer discovery for teams and infrastructure.
Xberg — Polyglot Document Intelligence Framework in Rust
A cross-language document extraction framework with a Rust core that parses PDFs, Office files, images, and 97+ formats into structured text and metadata.
Uno Platform — Pixel-Perfect Multi-Platform Apps with .NET
Build native mobile, desktop, and web applications from a single C# and XAML codebase targeting Windows, iOS, Android, macOS, Linux, and WebAssembly with pixel-perfect fidelity.
D2 — Declarative Diagram Scripting Language
A modern diagram scripting language that turns text into diagrams, offering a readable syntax for architecture, flow, and sequence diagrams rendered from code.