mirror of https://github.com/status-im/metro.git
Check if node_modules dir exists before adding to search queue
Summary: We can keep the `searchQueue` cleaner by using `this._fastfs.dirExists` on the potential `node_modules` directory. In addition to avoiding useless lookups, this also makes the error message provided by #9832 much more understandable. /cc davidaurelio Closes https://github.com/facebook/react-native/pull/9973 Differential Revision: D3887053 Pulled By: davidaurelio fbshipit-source-id: 6a5a488bb4217dd0f9db1c9c9f988b498c746ca9
This commit is contained in:
parent
047cbf9d59
commit
2d21260ce6
|
@ -358,9 +358,12 @@ class ResolutionRequest {
|
|||
for (let currDir = path.dirname(fromModule.path);
|
||||
currDir !== realPath.parse(fromModule.path).root;
|
||||
currDir = path.dirname(currDir)) {
|
||||
searchQueue.push(
|
||||
path.join(currDir, 'node_modules', realModuleName)
|
||||
);
|
||||
let searchPath = path.join(currDir, 'node_modules');
|
||||
if (this._fastfs.dirExists(searchPath)) {
|
||||
searchQueue.push(
|
||||
path.join(searchPath, realModuleName)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (this._extraNodeModules) {
|
||||
|
|
Loading…
Reference in New Issue