-
Notifications
You must be signed in to change notification settings - Fork 12.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
Make specifier generation from export map information conditional on module resolution mode #46670
Make specifier generation from export map information conditional on module resolution mode #46670
Conversation
…module resolution mode
} | ||
if (packageJsonContent.exports) { | ||
return { moduleFileToTry: path, blockedByExports: true }; | ||
if (getEmitModuleResolutionKind(options) === ModuleResolutionKind.Node12 || getEmitModuleResolutionKind(options) === ModuleResolutionKind.NodeNext) { |
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 made the whole of the exports map logic conditional - I could just make the failure modes conditional, but then we might make some specifiers that won't roundtrip through declaration emit (because we use an export map that we won't read in when we build the program), so this is probably better.
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.
Yeah, I think being symmetrical is the right call.
@typescript-bot cherry-pick this to release-4.5 |
Heya @DanielRosenwasser, I've started to run the task to cherry-pick this into |
Hey @DanielRosenwasser, I've opened #46671 for you. |
Component commits: 615a82c Make specifier generation from export map information conditional on module resolution mode
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.
however
rxjs
does legitimately have the problem that their types aren't directly visible in their export map, which makes locating a valid specifier for them when export maps are respected rather difficult.
Yeah, my understanding is that it’s fully expected that the layout of RxJS (export map not mentioning types and types in a completely different directory) means it’s basically unusable under the new resolution modes—they either need to move their types to be colocated with their JS or add a "types"
condition to their export map.
Component commits: 615a82c Make specifier generation from export map information conditional on module resolution mode Co-authored-by: Wesley Wigham <[email protected]>
…module resolution mode (microsoft#46670)
Fixes #46659
This fixes the regression on our part in
moduleResolution: node
, howeverrxjs
does legitimately have the problem that their types aren't directly visible in their export map, which makes locating a valid specifier for them when export maps are respected rather difficult.