TypeScript runtime comparisons
Comparison of Node.js TypeScript runtimes.
Disclaimer: This comparison is by the author & maintainer of tsx
Compared runtimes
Methodology
-
Tested on Node.js v12.20.0 because they all support it, and the node:
prefix is not supported in require()
-
Tested in both package types commonjs
& module
when applicable
Symbols
Symbol |
Description |
✅ |
Pass (Sometimes clickable) |
❌ |
Fail |
⛔️ |
Error (Hover to see error message) |
Project stats
Transformation
Supported transformation features and code tranformation correctness.
Package type: CommonJS
|
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 |
✅ |
✅ |
✅ |
❌ |
❌ |
✅ |
✅ |
Package type: Module
|
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
.
Resolution
Whether require()
/import()
can resolve a given specifier.
require()
import()
Interoperability
Whether it can correctly load a file for interoperability.
Package type: CommonJS
|
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 |
✅ |
⛔️ |
⛔️ |
⛔️ |
⛔️ |
✅ |
✅ |
Package type: Module
|
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 |
✅ |
⛔️ |
⛔️ |
✅ |
⛔️ |
✅ |
✅ |
Performance features
DX features
Testing