fix(js): resolve imports as native node apis before npm modules (#18358)

This commit is contained in:
Jason Jean 2023-07-28 10:33:40 -04:00 committed by GitHub
parent 35e95f0c53
commit 0fd8859c37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -60,6 +60,11 @@ export class TargetProjectLocator {
}
}
if (builtInModuleSet.has(normalizedImportExpr)) {
this.npmResolutionCache.set(normalizedImportExpr, null);
return null;
}
// try to find npm package before using expensive typescript resolution
const npmProject = this.findNpmPackage(normalizedImportExpr);
if (npmProject) {
@ -79,11 +84,6 @@ export class TargetProjectLocator {
}
}
if (builtInModuleSet.has(normalizedImportExpr)) {
this.npmResolutionCache.set(normalizedImportExpr, null);
return null;
}
try {
const resolvedModule = this.resolveImportWithRequire(
normalizedImportExpr,