-
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.
Handle correctly multiple requires to the same file with different forms
Summary: The traverse dependencies logic was using the absolute path of the resolved dependency to group the module dependencies, so for example if there's a module like: ``` const a = require('./a'); const a1 = require('./a.js'); ``` The traversal dependencies logic was just outputting a single dependency for that module. Since we're transforming each `require()` call to replace the relative path by a dependencyMap, the code from above was transformed to: ``` const a = require(_dependencyMap[0]); const a1 = require(_dependencyMap[1]); ``` But since the traverse dependencies logic could only find a single dependency, `_dependencyMap[1]` was undefined, causing a runtime error. This fixes #152 (more info in the task) Reviewed By: jeanlauliac Differential Revision: D7258093 fbshipit-source-id: 65c42b87e589430ecc96b906230dd7c4c55c2146
- Loading branch information
1 parent
6a587db
commit 233b00e
Showing
2 changed files
with
45 additions
and
21 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