Skip to content

Songkeys/swc-register

Repository files navigation

swc-register

NPM version NPM downloads

Transpile JSX, TypeScript and esnext features on the fly with swc.

It will respect your tsconfig.json (and .swcrc if provided).

Install

npm i @swc/core swc-register -D
# Or Yarn
yarn add @swc/core swc-register --dev
# Or pnpm
pnpm add @swc/core swc-register -D

Usage

node -r swc-register file.ts

It will use every mappable options from your tsconfig.json to make swc works.

You can also add an npm script:

"ts": "node -r swc-register"

Now just run npm run ts -- file.ts or yarn ts file.ts instead.

Programmatic Usage

const { register } = require('swc-register/dist/node')

register({
  // ...swc options
})

Similar Projects

There are some other swc registers like:

License

MIT

About

Transpile JSX, TypeScript and esnext features on the fly with swc with tsconfig.json respected

Resources

License

Stars

Watchers

Forks

Packages

No packages published