-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
fix(node): resolve types via package.json for directory import #22878
fix(node): resolve types via package.json for directory import #22878
Conversation
if let Some(resolution) = maybe_resolution { | ||
return Ok(Some(resolution)); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked into it and this seems to be done first before the index.d.ts probing.
throw new ERR_MODULE_NOT_FOUND( | ||
filename, | ||
path.resolve(pkgPath, "package.json"), | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC this was quite an important bit and some packages were checking for this ERR_MODULE_NOT_FOUND
code
property. Does this value still match after this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code was not used so I removed it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough, let's land as is, but just a warning for the future. I'm not 100% sure this was the exact code path that was checking for this code.
Does a package resolve when resolving types for a directory (copying the behaviour that typescript does).
…and#22878) Does a package resolve when resolving types for a directory (copying the behaviour that typescript does).
Does a package resolve when resolving types for a directory (copying the behaviour that typescript does).
Please merge on approval