mirror of https://github.com/status-im/metro.git
Small refactor in module resolution
Reviewed By: jeanlauliac Differential Revision: D6417509 fbshipit-source-id: 9c6abb8ceebb7048c775c9c9d21cd881f7e56c1f
This commit is contained in:
parent
5cc0939454
commit
b0de96c74a
|
@ -90,19 +90,21 @@ class ResolutionRequest<TModule: Moduleish, TPackage: Packageish> {
|
|||
const platform = this._options.platform;
|
||||
|
||||
if (
|
||||
!this._options.helpers.isNodeModulesDir(fromModule.path) &&
|
||||
!(isRelativeImport(toModuleName) || isAbsolutePath(toModuleName))
|
||||
isAbsolutePath(toModuleName) ||
|
||||
isRelativeImport(toModuleName) ||
|
||||
this._options.helpers.isNodeModulesDir(fromModule.path)
|
||||
) {
|
||||
const result = ModuleResolution.tryResolveSync(
|
||||
() => this._resolveHasteDependency(fromModule, toModuleName, platform),
|
||||
() =>
|
||||
resolver.resolveNodeDependency(fromModule, toModuleName, platform),
|
||||
return cacheResult(
|
||||
resolver.resolveNodeDependency(fromModule, toModuleName, platform),
|
||||
);
|
||||
return cacheResult(result);
|
||||
}
|
||||
|
||||
return cacheResult(
|
||||
resolver.resolveNodeDependency(fromModule, toModuleName, platform),
|
||||
ModuleResolution.tryResolveSync(
|
||||
() => this._resolveHasteDependency(fromModule, toModuleName, platform),
|
||||
() =>
|
||||
resolver.resolveNodeDependency(fromModule, toModuleName, platform),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue