tswc

Compile your TypeScript with tsconfig.json using swc
Changes
This version of tswc uses os.tmpdir
to create files instead of path.cwd
.
Install
npm install @esinx/tswc @swc/core -D
yarn add @esinx/tswc @swc/core --dev
Usage
Just change swc [...options]
to tswc -- [options]
. That's it! Your tsconfig.json
file will be respected.
For example:
tswc -- FILE
tswc -- FILE -o output.js
tswc -- DIR -d dir
See more about how to use swc cli.
You can change your build script in "package.json" as:
"build": "tswc -- src -D dist",
Now you can run npm run build
to build.
Notice
Only a subgroup of fields of tsconfig is supported currently. This is done with tsconfig-to-swcconfig. This means that some tsc features may be missing when compiling with this.
If you want to know what swc config is exactly used, you can use --debug
to inspect:
tswc --debug -- [other options...]
Advanced Options
Options:
--tsconfig <filename> the filename of tsconfig (default: tsconfig.json)
--debug output the final swc config (default: false)
-h, --help Display this message
-v, --version Display version number