-
Notifications
You must be signed in to change notification settings - Fork 102
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
tsconfig-paths behaves different from tsc and ts-node when resolving ambient declarations #51
Comments
Thanks for taking the time to put together the repro 👍 I took a quick look and first just one observation. Currently the Actually it is probably possible to simplify it further since import postcssNested from "postcss-nested";
console.log(postcssNested); Which will be compiled (simplified) into: const postcssNested = require("postcss-nested");
console.log(postcssNested); So we can probably simplify the repro even more by putting the above code in the I'll make a fork of the repro and try this out. |
My fork is here. I removed the usage of ts-node from So now to figure out what is going on. One possible scenario is that tsconfig-paths somehow resolves |
No problem! Good job so far!
Yes, that's my theory as well. I did a little ad-hoc logging and as seen in the stacktrace, this gets called. So, I think |
I added a test here to simulate the case in this issue's reproduction. This test passes however so it seems |
Did some more testing and found what is going on. The path will be resolved if the directory exists, even if no index.js exists. A failing test is here. |
So the bug is that tsconfig-paths will return true for from |
I puslished 3.4.2 where I think this is fixed now! @ljani please verify and if it works you can close this issue. |
Nice work, thanks! |
As noticed in TypeStrong/ts-node#615,
tsconfig-paths
behaves differently fromtsc
andts-node
whenpaths
contains a directory only havingindex.d.ts
file for a module and the module itself can be found fromnode_modules
.I've created a small sample here:
ljani/tsconfig-paths-51
To reproduce issue, run:
The text was updated successfully, but these errors were encountered: