Conversation
The `--loader` flag might be removed in future version. With `ts-node/esm-register` users will be able to register the loader using the `--import` flag.
|
This is great, we will get rid of if we use the |
|
Make sure to add esm-register.mjs to the files list in package.json. |
|
Regarding the proposed patch:
An example can be found here: |
|
Hi @jlenon7 did you have time to look at the proposed changes? Looking forward to this PR to be merged. If I can help, i would love to |
|
This looks good and it's nearly identical to the code Node recommends when using legacy |
|
Sorry the delay, I've uploaded the code with the suggestions. |
|
For further context and alternative example see :- #2100 |
|
So what's the resolution on this? Is it coming in? |
Well, the implementation is done. We just need to wait to the core contributors to merge it or some feedback if they need more changes. |
|
@jlenon7 Thanks for this PR. Thank You |
|
Any update on merging this pr? |
|
It would be lovely if we could get this merged |
|
Hey @cspotcode could you take a look on this please? |
|
npm i -D tsx This worked for me |
|
I agree with @programmingwithsalim . Either Sadly, (Additionally: we shall keep an eye on the built-in feature of Node.js to execute TypeScript files, which is also based on |
```bash npm i --save-dev typescript @types/node tsx ``` 🗞️ Newsflash: [ts-node is dead](TypeStrong/ts-node#2073 (comment)). (Indeed I had ample opportunity to confirm by myself that `ts-node`, `ts-mocha` et al hardly work at all with modern Node, what with the latter “helpfully” trying to parse the TypeScript by themselves, and failing miserably when you try to import a type.)
|
@albertodiazdorado, not to mention the speed benefits - which we've all heard about but I can anecdotally confirm have indeed been picked up for us too when running |
|
@davidthornton I think this link could help you to start https://nodejs.org/docs/latest-v22.x/api/typescript.html#type-stripping |
Register
ts-node/esmloader programmatically usingregisterfn.See issue #2072