Skip to content
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

Conversation

@weswigham
Copy link
Member

@weswigham weswigham commented Nov 3, 2021

Fixes #46659

This fixes the regression on our part in moduleResolution: node, 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.

}
if (packageJsonContent.exports) {
return { moduleFileToTry: path, blockedByExports: true };
if (getEmitModuleResolutionKind(options) === ModuleResolutionKind.Node12 || getEmitModuleResolutionKind(options) === ModuleResolutionKind.NodeNext) {
Copy link
Member Author

@weswigham weswigham Nov 3, 2021

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.

Copy link
Member

@andrewbranch andrewbranch Nov 3, 2021

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.

@DanielRosenwasser
Copy link
Member

@DanielRosenwasser DanielRosenwasser commented Nov 3, 2021

@typescript-bot cherry-pick this to release-4.5

@typescript-bot
Copy link
Collaborator

@typescript-bot typescript-bot commented Nov 3, 2021

Heya @DanielRosenwasser, I've started to run the task to cherry-pick this into release-4.5 on this PR at 615a82c. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

@typescript-bot typescript-bot commented Nov 3, 2021

Hey @DanielRosenwasser, I've opened #46671 for you.

typescript-bot pushed a commit to typescript-bot/TypeScript that referenced this issue Nov 3, 2021
Component commits:
615a82c Make specifier generation from export map information conditional on module resolution mode
Copy link
Member

@andrewbranch andrewbranch left a comment

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.

@andrewbranch andrewbranch merged commit d53630f into microsoft:main Nov 3, 2021
10 checks passed
DanielRosenwasser pushed a commit that referenced this issue Nov 5, 2021
Component commits:
615a82c Make specifier generation from export map information conditional on module resolution mode

Co-authored-by: Wesley Wigham <t-weswig@microsoft.com>
mprobst added a commit to mprobst/TypeScript that referenced this issue Jan 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

4 participants