Skip to content

perf(@angular/build): replace watchpack with @parcel/watcher and chokidar#33656

Draft
clydin wants to merge 4 commits into
angular:mainfrom
clydin:feat/replace-watchpack
Draft

perf(@angular/build): replace watchpack with @parcel/watcher and chokidar#33656
clydin wants to merge 4 commits into
angular:mainfrom
clydin:feat/replace-watchpack

Conversation

@clydin

@clydin clydin commented Jul 24, 2026

Copy link
Copy Markdown
Member

This change replaces the watchpack file watching dependency in @angular/build with @parcel/watcher as the primary native file watcher, while falling back to chokidar (v4) for polling or unsupported environments.

By leveraging @parcel/watcher's native C++ bindings (FSEvents, ReadDirectoryChangesW, inotify), file system watching is offloaded directly to OS kernel APIs, significantly reducing CPU and memory footprint during watch mode. Additionally, external directory watches are dynamically subsumed to minimize active native file handles, while early path filtering and event coalescing prevent redundant incremental rebuild triggers.

@clydin clydin added the target: minor This PR is targeted for the next minor release label Jul 24, 2026
@angular-robot angular-robot Bot added area: performance Issues related to performance area: @angular/build labels Jul 24, 2026
@clydin
clydin force-pushed the feat/replace-watchpack branch 2 times, most recently from 114d723 to b989632 Compare July 24, 2026 19:27
clydin added 2 commits July 24, 2026 23:43
…idar

This change replaces the watchpack file watching dependency in @angular/build with @parcel/watcher as the primary native file watcher, while falling back to chokidar (v4) for polling or unsupported environments.

By leveraging @parcel/watcher's native C++ bindings (FSEvents, ReadDirectoryChangesW, inotify), file system watching is offloaded directly to OS kernel APIs, significantly reducing CPU and memory footprint during watch mode. Additionally, external directory watches are dynamically subsumed to minimize active native file handles, while early path filtering and event coalescing prevent redundant incremental rebuild triggers.
@clydin
clydin force-pushed the feat/replace-watchpack branch from d8f6b10 to b085b59 Compare July 25, 2026 03:43
clydin added 2 commits July 25, 2026 11:33
…t closed state

When running Karma tests or when stream consumers (such as Architect test harness `executeOnce`) cancel the builder output stream early, both `ProgressNotifierReporter.onRunComplete` and `karma.Server` exit callbacks can attempt to enqueue results or close the `ReadableStreamController`.

Under WHATWG Streams specification rules, calling `.enqueue()` or `.close()` on a controller whose `desiredSize` is `null` (closed or cancelled) throws `TypeError [ERR_INVALID_STATE]: Invalid state: Controller is already closed`.

This change checks `controller.desiredSize !== null` and wraps enqueue/close calls in a try-catch block to gracefully handle closed controllers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: @angular/build area: performance Issues related to performance target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant