-
-
Notifications
You must be signed in to change notification settings - Fork 160
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
resolver prioritizes extension guessing over real path #617
resolver prioritizes extension guessing over real path #617
Comments
Looks like this is happening because tsx tries guessing extensions before trying the actual path. I was pretty sure this is how the TS resolver works but I'll have to evaluate the order again. So instead of trying If you'd interested, feel free to investigate the correct behavior and implement it. |
From what I can tell, this issue is caused by Lines 58 to 63 in 1affdd0
When that's called, {
conditions: [ 'node', 'import', 'node-addons' ],
importAttributes: {},
parentURL: 'file:///Users/nathan/git/tsx-dynamic-import-default-repro/src/index.ts'
}
tsx/src/utils/map-ts-extensions.ts Line 3 in 1affdd0
Normally, this would work, as we'd eventually fallback to asking Node to resolve {
"exports": {
"./*": "./*",
}
} This means that when I find it strange that |
This issue is now resolved in v4.16.3. If you're able to, your sponsorship would be very much appreciated. |
Acknowledgements
Minimal reproduction URL
https://github.com/nwalters512/tsx-dynamic-import-default-repro
Problem & expected behavior (under 200 words)
I would expect the exact same output when compiling the
src/index.ts
program to*.js
withtsc
and running the compiled file with Node, and when runningsrc/index.ts
directly withtsx
. Instead, the behavior is different:plugin
object has adefault
property.tsx
, theplugin
object does not have adefault
property.I'd be happy to further investigate and possibly fix this if you could point me in the direction of whatever part of
tsx
handles things like this (dynamic imports? ESM compat? I'm not sure exactly whattsx
does that would be causing this, I had assumed that this would all be strictly Node's responsibility.Bugs are expected to be fixed by those affected by it
Compensating engineering work will speed up resolution and support the project
The text was updated successfully, but these errors were encountered: