Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const platform = this._options.platform;
const allowHaste = !this._options.helpers.isNodeModulesDir(fromModule.path);
try {
return cacheResult(
resolver.resolveDependency(
fromModule,
toModuleName,
allowHaste,
platform,
),
);
} catch (error) {
if (error instanceof DuplicateHasteCandidatesError) {
throw new AmbiguousModuleResolutionError(fromModule.path, error);
}
if (error instanceof InvalidPackageError) {
throw new PackageResolutionError({
packageError: error,
originModulePath: fromModule.path,
targetModuleName: toModuleName,
});
}
throw error;
}
}