Skip to content

Fix nested package json lookup in modes that respect package.json exports #51995

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

Merged
merged 1 commit into from
Jan 11, 2023

Conversation

andrewbranch
Copy link
Member

Fixes an issue noticed in #51973

I spent the better part of two days trying to rewrite loadModuleFromSpecificNodeModulesDirectory and loadNodeModuleFromDirectoryWorker. I noticed some other bugs buried in them, and they have a bunch of duplication between them and are incredibly hard to follow. In the end I decided to just try to fix this bug as narrowly as possible first, as I was afraid a bigger refactoring would surface other bugs I wouldn’t have time to fix before the 5.0 RC.

@typescript-bot typescript-bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Dec 22, 2022
@andrewbranch andrewbranch marked this pull request as ready for review December 22, 2022 20:10
return withPackageId(packageInfo, fromDirectory);
if (rest !== "" && packageInfo && (
!(state.features & NodeResolutionFeatures.Exports) ||
!hasProperty((rootPackageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state))?.contents.packageJsonContent ?? emptyArray, "exports")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume that non-embedded assignment is many more lines of code, but .. that assignment is really easy to miss.

@andrewbranch andrewbranch merged commit 14b0d6d into microsoft:main Jan 11, 2023
@andrewbranch andrewbranch deleted the bug/bundler-at-types branch January 11, 2023 00:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants