Skip to content

Latest commit

 

History

History
36 lines (27 loc) · 1.01 KB

File metadata and controls

36 lines (27 loc) · 1.01 KB
title SWC

SWC support is built-in via the --swc flag or "swc": true tsconfig option.

SWC is a TypeScript-compatible transpiler implemented in Rust. This makes it an order of magnitude faster than vanilla transpileOnly.

To use it, first install @swc/core or @swc/wasm. If using importHelpers, also install @swc/helpers. If target is less than "es2015" and using async/await or generator functions, also install regenerator-runtime.

npm i -D @swc/core @swc/helpers regenerator-runtime

Then add the following to your tsconfig.json.

{
  "ts-node": {
    "swc": true
  }
}

Note, if you are using a swc configuration file, you can tell ts-node to load the file by supplying the swcConfig argument:

{
  "ts-node": {
    "swc": true,
    "swcConfig": ".development.scwrc"
  }
}

SWC uses @swc/helpers instead of tslib. If you have enabled importHelpers, you must also install @swc/helpers.