privatenumber / ts-runtime-comparison

Comparison of Node.js TypeScript runtimes
475 stars 8 forks source link

Add @swc-node/register to comparison matrix #3

Closed paambaati closed 2 years ago

paambaati commented 2 years ago

I’ve been using https://www.npmjs.com/package/@swc-node/register as a replacement for ts-node and it’s been working great.

I’d love to see it included in this comparison.

privatenumber commented 2 years ago

I've considered it, but it doesn't appear to be advertised as a TypeScript runtime so it would be unfairly compared.

The "register" in @swc-node/register implies CJS hook, which means it will only transform in CJS contexts and fail the ESM half of the tests in this comparison. Also, I would have to add other CJS hooks like esbuild-register, which have the same limitation.

I may consider supporting SWC via ts-node though.

privatenumber commented 2 years ago

I tried adding ts-node with SWC enabled, and the results were identical to ts-node so I decided not to keep it. There's probably speed gains though.

I added swc-node though even though it's CJS only: https://github.com/privatenumber/ts-runtime-comparison/commit/a09e15196bc2052e97807292324539965cc8710f