🔧
Build Tool10M+/wkApache-2.0

@swc/core

SWC (Speedy Web Compiler) is a Rust-based JavaScript/TypeScript compiler that provides a drop-in replacement for Babel with dramatically faster compilation spee

Installation

npm
npm install -D @swc/core
yarn
yarn add -D @swc/core
pnpm
pnpm add -D @swc/core

Import

ESM
import { transform } from '@swc/core';

Quick Example

usage
import { transformSync } from '@swc/core';

const output = transformSync('const x: number = 1;', {
  jsc: {
    parser: { syntax: 'typescript' },
    target: 'es2020',
  },
});

console.log(output.code);

About @swc/core

SWC (Speedy Web Compiler) is a Rust-based JavaScript/TypeScript compiler that provides a drop-in replacement for Babel with dramatically faster compilation speeds. SWC can parse, transform, and minify JavaScript and TypeScript code 20-70x faster than Babel by leveraging Rust's performance characteristics and efficient memory management. The compiler supports all modern JavaScript features, TypeScript, JSX/TSX, decorators (both legacy and stage 3), and common Babel plugins including module transforms, dead code elimination, and polyfill injection. SWC's minifier (swc-minify) provides an alternative to Terser with comparable output quality at significantly faster speeds. The compiler integrates with build tools through @swc/core for programmatic usage, swc-loader for Webpack, @swc/jest for Jest, and is used internally by Next.js and Parcel as their default TypeScript/JavaScript compiler. SWC also provides a bundler (swcpack) that aims to be a Webpack alternative, though it is still experimental. SWC's speed makes it particularly impactful in large codebases where Babel compilation times become a significant bottleneck during development and CI builds.

Quick Facts

Package@swc/core
CategoryBuild Tool
Weekly Downloads10M+
LicenseApache-2.0
Installnpm install -D @swc/core

Related Packages

Browse npm Packages by Category

Explore our reference of 200 popular npm packages with install commands, examples, and quick-start guides.