From 1628125bcbc2c41c40759f7cf5aa2393de3bb8ad Mon Sep 17 00:00:00 2001 From: Syam Gadde Date: Tue, 11 Nov 2025 09:41:55 -0500 Subject: [PATCH] fix(compiler-cli): ignore non-existent files Ignore files that fail fs.exists() rather than throw ENOENT. Some applications deliberately create "broken" symbolic links that are not relevant to compilation (e.g. emacs lock files that link to owner "user@host"). --- .../ngtsc/file_system/src/ts_read_directory.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/compiler-cli/src/ngtsc/file_system/src/ts_read_directory.ts b/packages/compiler-cli/src/ngtsc/file_system/src/ts_read_directory.ts index 1b4e0281ad6..c69628b4468 100644 --- a/packages/compiler-cli/src/ngtsc/file_system/src/ts_read_directory.ts +++ b/packages/compiler-cli/src/ngtsc/file_system/src/ts_read_directory.ts @@ -90,10 +90,18 @@ export function createFileSystemTsReadDirectoryFn( const directories: string[] = []; for (const child of children) { - if (fs.stat(fs.join(resolvedPath, child))?.isDirectory()) { - directories.push(child); - } else { - files.push(child); + try { + if (fs.stat(fs.join(resolvedPath, child))?.isDirectory()) { + directories.push(child); + } else { + files.push(child); + } + } catch (error) { + if (error instanceof Error && error.message.includes('ENOENT')) { + // may be a dangling link or other file system error, ignore + continue; + } + throw error; } }