swc
Fast Rust-based JavaScript and TypeScript compiler
TLDR
Compile file
SYNOPSIS
swc [-o output] [-d dir] [-w] [options] input
DESCRIPTION
swc (Speedy Web Compiler) is a JavaScript and TypeScript compiler written in Rust, designed as a significantly faster alternative to Babel. It handles transpilation, JSX transformation, TypeScript stripping, and minification in a single tool.
The compiler supports modern JavaScript features, downlevel compilation to older targets, and React JSX transformation. TypeScript files are compiled by stripping types without performing type checking, making it much faster than tsc for builds where type checking is handled separately.
SWC can process individual files, entire directories with watch mode for development, and generates source maps for debugging. It is used as the compilation engine by tools like Next.js and Parcel.
PARAMETERS
-o FILE
Output file.-d DIR
Output directory.-w
Watch mode.--source-maps
Generate source maps.--config-file FILE
Configuration file.--sync
Synchronous mode.
CONFIGURATION
.swcrc
Project configuration file in JSON format defining compilation target, module type, JSX settings, and minification options.
CAVEATS
Less plugins than Babel. Rust ecosystem. Config differs from Babel.
HISTORY
SWC (Speedy Web Compiler) was created by Donny as a fast JavaScript/TypeScript compiler written in Rust.
