Skip to content

Commit f865460

Browse files
committed
fix: support deeply nested pnpm virtual store node_modules paths in resolveAndRunNgcc
Uses indexOf instead of lastIndexOf in resolveAndRunNgcc. This resolves the case where a user is using pnpm and ngcc is resolved through symlinks to a deeply nested virtual store node_modules location: `some/user/path/node_modules/.pnpm/@angular/[email protected]/node_modules/@angular/compiler-cli/...` lastIndexOf would resolve to `some/user/path/node_modules/.pnpm/@angular/[email protected]` which is incorrect. indexOf gets you to the desired `some/user/path`
1 parent 209947f commit f865460

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

server/src/ngcc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export async function resolveAndRunNgcc(tsconfig: string, progress: Progress): P
2727
if (!ngcc) {
2828
throw new Error(`Failed to resolve ngcc from ${directory}`);
2929
}
30-
const index = ngcc.resolvedPath.lastIndexOf('node_modules');
30+
const index = ngcc.resolvedPath.indexOf('node_modules');
3131
// By default, ngcc assumes the node_modules directory that it needs to process
3232
// is in the cwd. In our case, we should set cwd to the directory where ngcc
3333
// is resolved to, not the directory where tsconfig.json is located. See

0 commit comments

Comments
 (0)