fix(core): resolve npm packages after typescript

This commit is contained in:
Jason Jean 2021-06-16 10:37:31 -04:00 committed by Victor Savkin
parent 84f873dcdb
commit c5ccd9c2fb

View File

@ -69,12 +69,6 @@ export class TargetProjectLocator {
} }
} }
// try to find npm package before using expensive typescript resolution
const npmProject = this.findNpmPackage(importExpr);
if (npmProject || this.npmResolutionCache.has(importExpr)) {
return npmProject;
}
let resolvedModule: string; let resolvedModule: string;
if (this.typescriptResolutionCache.has(normalizedImportExpr)) { if (this.typescriptResolutionCache.has(normalizedImportExpr)) {
resolvedModule = this.typescriptResolutionCache.get(normalizedImportExpr); resolvedModule = this.typescriptResolutionCache.get(normalizedImportExpr);
@ -97,6 +91,13 @@ export class TargetProjectLocator {
return resolvedProject; return resolvedProject;
} }
} }
// try to find npm package before using expensive typescript resolution
const npmProject = this.findNpmPackage(importExpr);
if (npmProject || this.npmResolutionCache.has(importExpr)) {
return npmProject;
}
// TODO: meeroslav this block should be probably removed // TODO: meeroslav this block should be probably removed
const importedProject = this.sortedWorkspaceProjects.find((p) => { const importedProject = this.sortedWorkspaceProjects.find((p) => {
const projectImport = `@${npmScope}/${p.data.normalizedRoot}`; const projectImport = `@${npmScope}/${p.data.normalizedRoot}`;