Skip to content

fix(@angular/build): recursively ignore output and cache paths in watch mode - #33812

Merged
alan-agius4 merged 1 commit into
angular:mainfrom
clydin:fix/watch-ignore-output-path
Aug 7, 2026
Merged

fix(@angular/build): recursively ignore output and cache paths in watch mode#33812
alan-agius4 merged 1 commit into
angular:mainfrom
clydin:fix/watch-ignore-output-path

Conversation

@clydin

@clydin clydin commented Aug 7, 2026

Copy link
Copy Markdown
Member

When watching for file changes, @parcel/watcher and chokidar use glob matching against the ignored patterns. Passing exact directory paths without recursive glob wildcards (/**) fails to match nested output artifacts and cache files on disk. Additionally, unnormalized Windows path separators in directory paths prevent POSIX glob engines from matching. When directory watching or NG_BUILD_WATCH_ROOT is enabled, mutations inside the output directory (such as emitted bundles or deleted files during rebuild cleanup) were falsely detected as modified source files, triggering spurious rebuilds and causing race conditions on missing output files.

Output and cache directory paths are now POSIX-normalized and configured with recursive glob patterns (/**) so all nested files and subdirectories are properly ignored by the watcher.

…ch mode

When watching for file changes, @parcel/watcher and chokidar use glob matching against the ignored patterns. Passing exact directory paths without recursive glob wildcards (`/**`) fails to match nested output artifacts and cache files on disk. Additionally, unnormalized Windows path separators in directory paths prevent POSIX glob engines from matching. When directory watching or NG_BUILD_WATCH_ROOT is enabled, mutations inside the output directory (such as emitted bundles or deleted files during rebuild cleanup) were falsely detected as modified source files, triggering spurious rebuilds and causing race conditions on missing output files.

Output and cache directory paths are now POSIX-normalized and configured with recursive glob patterns (`/**`) so all nested files and subdirectories are properly ignored by the watcher.
@clydin clydin added the target: minor This PR is targeted for the next minor release label Aug 7, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces changes to normalize and ignore output and cache paths during the build process, adding support for glob patterns in Chokidar's watcher using the picomatch library. A critical issue was identified in the watcher implementation where { path, recursive } objects are passed to Chokidar's ignored option, which is unsupported and will cause non-glob patterns to be silently ignored. A code suggestion has been provided to resolve this by returning a custom matching function instead.

Comment thread packages/angular/build/src/tools/esbuild/watcher.ts
@alan-agius4 alan-agius4 added the action: merge The PR is ready for merge by the caretaker label Aug 7, 2026
@alan-agius4
alan-agius4 merged commit 0d98516 into angular:main Aug 7, 2026
69 of 70 checks passed
@alan-agius4

Copy link
Copy Markdown
Collaborator

This PR was merged into the repository. The changes were merged into the following branches:

@clydin
clydin deleted the fix/watch-ignore-output-path branch August 7, 2026 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: @angular/build target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants