TypeStrong / ts-node

TypeScript execution and REPL for node.js
https://typestrong.org/ts-node
MIT License
12.93k stars 532 forks source link

feat(esm): initialize hook - register(_,[_,tsNodeOptions]) #2108

Open calebboyd opened 9 months ago

calebboyd commented 9 months ago

Opening for feedback!

It would be nice to pass ts-node options via the node register call.

Enabling an entry point like the following:

import { register } from 'node:module'

register(import.meta.resolve('ts-node/esm'), {
  data: {
    swc: true,
    preferTsExts: true,
  },
})

await import('./main.js')