-
Notifications
You must be signed in to change notification settings - Fork 308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ts-node cannot transpile on nodeJS 20 #1246
Comments
@wataruian Yep, this a warning we intentionally emit here The TL;DR of it is that Node changed some things in v20 that broke how ts-node's esm loader was working. Because of that, we're not able to compile ESM at runtime when using node 20. However it is possible to use tsx. You just need to replace the shebang in your Here's a reading list in case you're curious:
If it's okay with you, I'm going to close this issue since we already have an issue about ts-node + ESM + node 20 and there's a viable workaround - but please reopen it if you feel otherwise. Thanks! |
Just realized that the original oclif/core issue about this was closed. So I'm going to keep this one open and pin it since others are likely to run into this |
@mdonnalley, I am not sure how to make I tried to replace
If I tried to invoke with
Am I doing something wrong? |
Update: I was able to make
I am unsure if I did it clean enough or in best practice, but it works. With this, I can compile the new code on the fly during dev mode which |
Closing this since users can switch to tsx or bun (oclif/core#966) or use a different node version |
Do you want to request a feature or report a bug?
I'm not sure if this is intended behavior or a bug
What is the current behavior?
When using ts-node with oclif, warning appears and the existing compiled source is executed instead
Warning: ts-node executable cannot transpile ESM in Node 20. Existing compiled source will be used instead.
This affects the development experience because you will need to compile in order to test existing code.
Will it be possible to use
tsx
instead ofts-node
?What is the expected behavior?
Able to transpile code in dev mode.
"@oclif/core": "^3.15.1"
Node: v20.10.0
The text was updated successfully, but these errors were encountered: