swc-register

1.0.5 • Public • Published

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

Package Sidebar

Install

npm i swc-register

Weekly Downloads

7

Version

1.0.5

License

MIT

Unpacked Size

4.6 kB

Total Files

5

Last publish

Collaborators

  • songkeys