Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): watch symlink when using `preserv…
Browse files Browse the repository at this point in the history
…eSymlinks` option

When using the esbuild based builder symlinks are not watched when `preserveSymlinks` is enabled.

Closes #26585

(cherry picked from commit ffa2d07)
  • Loading branch information
alan-agius4 authored and clydin committed Dec 5, 2023
1 parent f9e982c commit a8dbf1d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export async function* runEsBuildBuildAction(
deleteOutputPath?: boolean;
poll?: number;
signal?: AbortSignal;
preserveSymlinks?: boolean;
},
): AsyncIterable<(ExecutionResult['outputWithFiles'] | ExecutionResult['output']) & BuilderOutput> {
const {
Expand All @@ -48,6 +49,7 @@ export async function* runEsBuildBuildAction(
projectRoot,
workspaceRoot,
progress,
preserveSymlinks,
} = options;

if (deleteOutputPath && writeToFileSystem) {
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export async function* buildApplicationInternal(
},
{
watch: normalizedOptions.watch,
preserveSymlinks: normalizedOptions.preserveSymlinks,
poll: normalizedOptions.poll,
deleteOutputPath: normalizedOptions.deleteOutputPath,
cacheOptions: normalizedOptions.cacheOptions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down

0 comments on commit a8dbf1d

Please sign in to comment.