TypeScript runtime comparisons

February 9, 2023 · View on GitHub

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

SymbolDescription
Pass (Sometimes clickable)
Fail
⛔️Error (Hover to see error message)

Project stats

tsx@swc/registeresbuild-runnerjitisucrasets-nodetsm
npm downloads
Install size
GitHub stars
Issues open
Issues closed
Last commit

Transformation

Supported transformation features and code tranformation correctness.

Package type: CommonJS

tsx@swc/registeresbuild-runnerjitisucrasets-nodetsm
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/registeresbuild-runnerjitisucrasets-nodetsm
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()

tsx@swc/registeresbuild-runnerjitisucrasets-nodetsm
.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

import()

tsx@swc/registeresbuild-runnerjitisucrasets-nodetsm
.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

Interoperability

Whether it can correctly load a file for interoperability.

Package type: CommonJS

tsx@swc/registeresbuild-runnerjitisucrasets-nodetsm
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/registeresbuild-runnerjitisucrasets-nodetsm
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

tsx@swc/registeresbuild-runnerjitisucrasets-nodetsm
CompileresbuildSWCesbuildBabelSucrase (Babel fork)TypeScript / SWCesbuild
Disk cache????

DX features

tsx@swc/registeresbuild-runnerjitisucrasets-nodetsm
TypeScript REPL??
Watch mode?
Type checking
Hides experimental feature warnings----?
Binariestsxswc-nodeesrjitisucrase-nodets-node, ts-node-esm, +4tsm

Testing

tsx@swc/registeresbuild-runnerjitisucrasets-nodetsm
Operating systemsLinux & WindowsLinuxNo testsLinux & WindowsLinuxLinux & WindowsLinux & Windows
Node.js versions12.20 ~ 18Latest LTSNo tests1614 & 1612 ~ 18 + Nightly12.22.10 ~ 16.14