Comparison of Node.js TypeScript runtimes.
Disclaimer: This comparison is by the author & maintainer of tsx
-
Tested on Node.js v12.20.0 because they all support it, and the
node:
prefix is not supported inrequire()
-
Tested in both package types
commonjs
&module
when applicable
Symbol | Description |
---|---|
✅ | Pass (Sometimes clickable) |
❌ | Fail |
⛔️ | Error (Hover to see error message) |
tsx | @swc/register | esbuild-runner | jiti | sucrase | ts-node | tsm | |
---|---|---|---|---|---|---|---|
npm downloads | |||||||
Install size | |||||||
GitHub stars | |||||||
Bugs | |||||||
Issues open | |||||||
Issues closed |
Supported transformation features and code tranformation correctness.
tsx | @swc/register | esbuild-runner | jiti | sucrase | ts-node | tsm | |
---|---|---|---|---|---|---|---|
TypeScript syntax | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
ESM → CJS: import/export syntax | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ | ❌ |
ESM → CJS: import.meta.url shim |
✅ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ |
CJS scope in .js file |
✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
CJS scope in .ts file |
✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ |
CJS scope in .cjs file |
✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
CJS scope in .cts file |
✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ |
No CJS scope in .mjs file |
✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ |
No CJS scope in .mts file |
✅ | ❌ | ❌ | ❌ | ❌ | ✅ | ✅ |
Source maps | ✅ | ✅ | ✅ | ❌ | ❌ | ✅ | ❌ |
tsx | @swc/register | esbuild-runner | jiti | sucrase | ts-node | tsm | |
---|---|---|---|---|---|---|---|
TypeScript syntax | ✅ | ⛔️ | ⛔️ | ✅ | ⛔️ | ✅ | ✅ |
CJS scope in .cjs file |
✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
CJS scope in .cts file |
✅ | ⛔️ | ⛔️ | ✅ | ⛔️ | ✅ | ❌ |
No CJS scope in .js file |
✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ |
No CJS scope in .ts file |
✅ | ⛔️ | ⛔️ | ❌ | ⛔️ | ✅ | ✅ |
No CJS scope in .mjs file |
✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ |
No CJS scope in .mts file |
✅ | ⛔️ | ⛔️ | ❌ | ⛔️ | ✅ | ✅ |
Source maps | ✅ | ⛔️ | ⛔️ | ❌ | ⛔️ | ✅ | ❌ |
* CommonJS scope (CJS scope) refers to having the following variables available in the module scope: module
, exports
, require
, __filename
, __dirname
.
Whether require()
/import()
can resolve a given specifier.
tsx | @swc/register | esbuild-runner | jiti | sucrase | ts-node | tsm | |
---|---|---|---|---|---|---|---|
.ts file |
✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
.ts file via .js |
✅ | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ |
.ts file without extension |
✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ |
index.ts file via directory |
✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ |
.cts file |
✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
.cts file via .cjs |
✅ | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ |
.mts file |
✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ |
.mts file via .mjs |
✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
node: prefix |
✅ | ❌ | ❌ | ✅ | ❌ | ❌ | ✅ |
tsconfig.json paths | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
tsx | @swc/register | esbuild-runner | jiti | sucrase | ts-node | tsm | |
---|---|---|---|---|---|---|---|
.ts file |
✅ | ❌ | ❌ | ❌ | ✅ | ✅ | ✅ |
.ts file via .js |
✅ | ❌ | ❌ | ❌ | ❌ | ✅ | ✅ |
.ts file without extension |
✅ | ❌ | ❌ | ❌ | ✅ | ❌ | ✅ |
index.ts file via directory |
✅ | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ |
.cts file |
✅ | ❌ | ❌ | ❌ | ✅ | ✅ | ✅ |
.cts file via .cjs |
✅ | ❌ | ❌ | ❌ | ❌ | ✅ | ✅ |
.mts file |
✅ | ❌ | ❌ | ❌ | ✅ | ✅ | ✅ |
.mts file via .mjs |
✅ | ❌ | ❌ | ❌ | ❌ | ✅ | ✅ |
tsconfig.json paths | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
Whether it can correctly load a file for interoperability.
tsx | @swc/register | esbuild-runner | jiti | sucrase | ts-node | tsm | |
---|---|---|---|---|---|---|---|
require() .js file (ESM export) |
✅ | ⛔️ | ✅ | ✅ | ✅ | ✅ | ⛔️ |
require() .ts file (ESM export) |
✅ | ⛔️ | ✅ | ✅ | ✅ | ✅ | ⛔️ |
require() .cjs file |
✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
require() .cts file |
✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
require() .mjs file |
✅ | ⛔️ | ✅ | ✅ | ⛔️ | ⛔️ | ⛔️ |
require() .mts file |
✅ | ⛔️ | ⛔️ | ⛔️ | ⛔️ | ⛔️ | ⛔️ |
import() .js file (ESM export) |
✅ | ⛔️ | ❌ | ⛔️ | ✅ | ❌ | ⛔️ |
import() .ts file (ESM export) |
✅ | ⛔️ | ⛔️ | ⛔️ | ✅ | ❌ | ✅ |
import() .cjs file |
✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ |
import() .cts file |
✅ | ⛔️ | ⛔️ | ⛔️ | ❌ | ✅ | ✅ |
import() .mjs file |
✅ | ✅ | ✅ | ✅ | ⛔️ | ✅ | ✅ |
import() .mts file |
✅ | ⛔️ | ⛔️ | ⛔️ | ⛔️ | ✅ | ✅ |
tsx | @swc/register | esbuild-runner | jiti | sucrase | ts-node | tsm | |
---|---|---|---|---|---|---|---|
require() .js file (ESM export) |
✅ | ⛔️ | ⛔️ | ⛔️ | ⛔️ | ⛔️ | ⛔️ |
require() .ts file (ESM export) |
✅ | ⛔️ | ✅ | ⛔️ | ✅ | ⛔️ | ⛔️ |
require() .cjs file |
✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
require() .cts file |
✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
require() .mjs file |
✅ | ⛔️ | ✅ | ⛔️ | ⛔️ | ⛔️ | ⛔️ |
require() .mts file |
✅ | ⛔️ | ⛔️ | ⛔️ | ⛔️ | ⛔️ | ⛔️ |
import() .js file (ESM export) |
✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
import() .ts file (ESM export) |
✅ | ⛔️ | ⛔️ | ✅ | ⛔️ | ✅ | ✅ |
import() .cjs file |
✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ |
import() .cts file |
✅ | ⛔️ | ⛔️ | ❌ | ⛔️ | ✅ | ✅ |
import() .mjs file |
✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
import() .mts file |
✅ | ⛔️ | ⛔️ | ⛔️ | ⛔️ | ✅ | ✅ |
tsx | @swc/register | esbuild-runner | jiti | sucrase | ts-node | tsm | |
---|---|---|---|---|---|---|---|
Compiler | esbuild | SWC | esbuild | Babel | Sucrase (Babel fork) | TypeScript / SWC | esbuild |
Disk cache | ✅ ? | ❌ | ✅ ? | ✅ ? | ❌ | ❌ ? | ❌ |
tsx | @swc/register | esbuild-runner | jiti | sucrase | ts-node | tsm | |
---|---|---|---|---|---|---|---|
TypeScript REPL | ✅ ? | ❌ | ❌ | ❌ | ❌ | ✅ ? | ❌ |
Watch mode | ✅ ? | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
Type checking | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ |
Hides experimental feature warnings | ✅ | - | - | - | - | ✅ ? | ❌ |
Binaries | tsx | swc-node | esr | jiti | sucrase-node | ts-node, ts-node-esm, +4 | tsm |
tsx | @swc/register | esbuild-runner | jiti | sucrase | ts-node | tsm | |
---|---|---|---|---|---|---|---|
Operating systems | Linux & Windows | Linux | No tests | Linux & Windows | Linux | Linux & Windows | Linux & Windows |
Node.js versions | 12.20 ~ 18 | Latest LTS | No tests | 16 | 14 & 16 | 12 ~ 18 + Nightly | 12.22.10 ~ 16.14 |