From a8dbf1da27faf772a4df382b1301e95c32d1ba89 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Tue, 5 Dec 2023 15:09:39 +0000 Subject: [PATCH] fix(@angular-devkit/build-angular): watch symlink when using `preserveSymlinks` option When using the esbuild based builder symlinks are not watched when `preserveSymlinks` is enabled. Closes #26585 (cherry picked from commit ffa2d07c8e8b63aac218770918a657235d44b645) --- .../build_angular/src/builders/application/build-action.ts | 3 +++ .../build_angular/src/builders/application/index.ts | 1 + .../angular_devkit/build_angular/src/tools/esbuild/watcher.ts | 2 ++ 3 files changed, 6 insertions(+) diff --git a/packages/angular_devkit/build_angular/src/builders/application/build-action.ts b/packages/angular_devkit/build_angular/src/builders/application/build-action.ts index b7c4030bf7a7..fb0ed18a8dbf 100644 --- a/packages/angular_devkit/build_angular/src/builders/application/build-action.ts +++ b/packages/angular_devkit/build_angular/src/builders/application/build-action.ts @@ -33,6 +33,7 @@ export async function* runEsBuildBuildAction( deleteOutputPath?: boolean; poll?: number; signal?: AbortSignal; + preserveSymlinks?: boolean; }, ): AsyncIterable<(ExecutionResult['outputWithFiles'] | ExecutionResult['output']) & BuilderOutput> { const { @@ -48,6 +49,7 @@ export async function* runEsBuildBuildAction( projectRoot, workspaceRoot, progress, + preserveSymlinks, } = options; if (deleteOutputPath && writeToFileSystem) { @@ -79,6 +81,7 @@ export async function* runEsBuildBuildAction( watcher = createWatcher({ polling: typeof poll === 'number', interval: poll, + followSymlinks: preserveSymlinks, ignored: [ // Ignore the output and cache paths to avoid infinite rebuild cycles outputPath, diff --git a/packages/angular_devkit/build_angular/src/builders/application/index.ts b/packages/angular_devkit/build_angular/src/builders/application/index.ts index a2868d2df27e..c89745f97558 100644 --- a/packages/angular_devkit/build_angular/src/builders/application/index.ts +++ b/packages/angular_devkit/build_angular/src/builders/application/index.ts @@ -64,6 +64,7 @@ export async function* buildApplicationInternal( }, { watch: normalizedOptions.watch, + preserveSymlinks: normalizedOptions.preserveSymlinks, poll: normalizedOptions.poll, deleteOutputPath: normalizedOptions.deleteOutputPath, cacheOptions: normalizedOptions.cacheOptions, diff --git a/packages/angular_devkit/build_angular/src/tools/esbuild/watcher.ts b/packages/angular_devkit/build_angular/src/tools/esbuild/watcher.ts index 347afc4f034f..da6b2c8de02e 100644 --- a/packages/angular_devkit/build_angular/src/tools/esbuild/watcher.ts +++ b/packages/angular_devkit/build_angular/src/tools/esbuild/watcher.ts @@ -39,11 +39,13 @@ export function createWatcher(options?: { polling?: boolean; interval?: number; ignored?: string[]; + followSymlinks?: boolean; }): BuildWatcher { const watcher = new FSWatcher({ usePolling: options?.polling, interval: options?.interval, ignored: options?.ignored, + followSymlinks: options?.followSymlinks, disableGlobbing: true, ignoreInitial: true, });