TypeStrong / ts-node

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

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

Open calebboyd opened 4 months ago

calebboyd commented 4 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')