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

Fix handling of empty 'types', 'typings', etc. fields in package.json #31539

Merged
merged 1 commit into from May 24, 2019

Conversation

rbuckton
Copy link
Member

According to the documentation for Node's module resolution:

LOAD_AS_DIRECTORY(X)
1. If X/package.json is a file,
   a. Parse X/package.json, and look for "main" field.
   b. If "main" is a falsy value, GOTO 2.
   c. let M = X + (json main field)
   d. LOAD_AS_FILE(M)
   e. LOAD_INDEX(M)
   f. LOAD_INDEX(X) DEPRECATED
   g. THROW "not found"
2. LOAD_INDEX(X)

Step 1.b. indicates we should ignore a "falsy" value for "main", and we should probably do the same for "types", however in both cases we only check for undefined and allow "". This PR changes our behavior to align with NodeJS and ignore "".

Fixes #28304

@rbuckton rbuckton merged commit dfd28d2 into master May 24, 2019
@rbuckton rbuckton deleted the fix28304 branch July 27, 2019 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

typesVersions should not be affected by "types": ""
2 participants