-
Notifications
You must be signed in to change notification settings - Fork 626
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only consider directory candidates when resolving path specifiers end…
…ing in a `/` Summary: When an import uses a relative (or absolute) module path specifier ending in a `/`, e.g. `require('./foo/')`, we should *not* consider `./foo.js` to be a candidate. The `/` implies `foo` must be a (symlink to a) directory. In the edge case where *both* `./foo.js` and `./foo/index.js` exist, Metro will currently incorrectly resolve `./foo/` to the former. Verified that this differs from Node.js and Webpack's `resolve`. ``` - **[Fix]:** Resolver: Only consider directory candidates when resolving path specifiers ending in a `/` ``` NOTE: This *could* be considered a breaking change, if so I'll hold it for RN 0.76. I'd argue though that it corrects a misalignment in Metro that could currently cause third-party (especially non-RN) packages to resolve incorrectly vs Node and other bundlers, and so it's a fix we'd potentially consider backporting. Reviewed By: GijsWeterings Differential Revision: D60731286 fbshipit-source-id: 60ea791e7cd65b597ae4d13955adc60192f107b8
- Loading branch information
1 parent
b83926b
commit 1e1dfe1
Showing
5 changed files
with
52 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters