ConfigsApr 12, 2026·3 min read

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.

TL;DR
SWC compiles JavaScript and TypeScript 20x faster than Babel using Rust, with full plugin support.
§01

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.

§02

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.

§03

How to use

  1. Install SWC as a dev dependency in your project.
  2. Create a .swcrc configuration file or pass options via CLI flags.
  3. Run npx swc src -d dist to compile your source directory.
§04

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"
  }
}
§05

Related on TokRepo

§06

Common pitfalls

  • SWC does not perform type checking. You still need tsc --noEmit in your CI pipeline for type safety.
  • Some Babel plugins have no SWC equivalent. Check the SWC plugin registry before migrating complex Babel configs.
  • The .swcrc file 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.

Frequently Asked Questions

How much faster is SWC compared to Babel?+

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.

Does SWC support TypeScript?+

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.

Can SWC replace Babel entirely?+

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.

Which frameworks use SWC?+

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.

Does SWC support bundling?+

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.

Citations (3)

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets