fix(@angular/build): use chokidar watcher when followSymlinks is enabled - #34060
Merged
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the createWatcher function to use the Chokidar watcher when followSymlinks is enabled, and adds a corresponding unit test to verify symlink change detection. The review feedback suggests ensuring the watcher is closed in the finally block of the test to prevent resource leaks in case of assertion failures.
When `preserveSymlinks` is enabled in application build options, `followSymlinks: true` is passed to `createWatcher`. With `@parcel/watcher`, native OS directory watchers (such as FSEvents, inotify, and ReadDirectoryChangesW) do not follow directory symlinks pointing outside the workspace root. Additionally, esbuild reports watch files under their symlinked workspace paths, preventing external directory watches from attaching and causing file modifications behind the symlink to be missed. Since `chokidar` natively traverses directory symlinks and surfaces file change events relative to the watched root, `createWatcher` now falls back to Chokidar when `followSymlinks` is enabled. This restores watch rebuild detection for symlinked directories while preserving the performance benefits of `@parcel/watcher` for standard setups. Closes angular#34039
clydin
force-pushed
the
fix/preserve-symlinks-watch
branch
from
September 9, 2026 19:18
4e92a64 to
7ca0a1a
Compare
alan-agius4
approved these changes
Sep 10, 2026
Member
Author
|
This PR was merged into the repository. The changes were merged into the following branches:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When
preserveSymlinksis enabled in application build options,followSymlinks: trueis passed tocreateWatcher.With
@parcel/watcher, native OS directory watchers (such as FSEvents, inotify, and ReadDirectoryChangesW) do not follow directory symlinks pointing outside the workspace root. Additionally, esbuild reports watch files under their symlinked workspace paths, preventing external directory watches from attaching and causing file modifications behind the symlink to be missed.Since
chokidarnatively traverses directory symlinks and surfaces file change events relative to the watched root,createWatchernow falls back to Chokidar whenfollowSymlinksis enabled. This restores watch rebuild detection for symlinked directories while preserving the performance benefits of@parcel/watcherfor standard setups.Closes #34039