-
-
Notifications
You must be signed in to change notification settings - Fork 533
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
import not working the same with ts-node and tsc + node #786
Comments
To understand why is this happening you should understand how nodejs resolves files
Now let's examine what happens when you use tsc:
Now according to the node docs when you try to Now let's examine how ts-node work : so require.extensions becomes [ '.js', '.json', '.node', '.ts', '.tsx' ] and according to the order of the array |
Is it possible to change the order of the files in require.extensions, so that |
I think it's a bad practice to use such kind of ambiguous setup , and it was a bad design decision of nodejs to allow such ambiguity Best to my knowledge #649 is trying fix this |
Yeah, I will rename files and thanks for the video. :) Moved the conversation to the issue mentioned (#648). |
Closing with #837. |
ts-node version v8.0.2
tsc version 3.3.3
Please take a look at ts-node-fail repo, there is a small repro.
If I execute
while there are no transpiled js files (so there's no config.js) config.ts import is messed up and I get output:
If I execute
import works as expected and I get full output
Am I using something wrong? Seems like ts-node just has the bad execution.
The text was updated successfully, but these errors were encountered: