Skip to content

Commit dd1752d

Browse files
committed
perf(@angular/build): replace watchpack with @parcel/watcher and chokidar
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.
1 parent 9671cc6 commit dd1752d

8 files changed

Lines changed: 936 additions & 90 deletions

File tree

‎package.json‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@
8989
"@types/picomatch": "^4.0.0",
9090
"@types/progress": "^2.0.3",
9191
"@types/semver": "^7.3.12",
92-
"@types/watchpack": "^2.4.4",
9392
"@types/yargs": "^17.0.20",
9493
"@types/yargs-parser": "^21.0.0",
9594
"@typescript-eslint/eslint-plugin": "8.64.0",

‎packages/angular/build/BUILD.bazel‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,11 @@ ts_project(
8686
":node_modules/@babel/helper-split-export-declaration",
8787
":node_modules/@inquirer/confirm",
8888
":node_modules/@oxc-project/types",
89+
":node_modules/@parcel/watcher",
8990
":node_modules/@vitejs/plugin-basic-ssl",
9091
":node_modules/beasties",
9192
":node_modules/browserslist",
93+
":node_modules/chokidar",
9294
":node_modules/https-proxy-agent",
9395
":node_modules/istanbul-lib-instrument",
9496
":node_modules/jsonc-parser",
@@ -110,7 +112,6 @@ ts_project(
110112
":node_modules/tinyglobby",
111113
":node_modules/vite",
112114
":node_modules/vitest",
113-
":node_modules/watchpack",
114115
"//:node_modules/@angular/common",
115116
"//:node_modules/@angular/compiler",
116117
"//:node_modules/@angular/compiler-cli",
@@ -125,7 +126,6 @@ ts_project(
125126
"//:node_modules/@types/node",
126127
"//:node_modules/@types/picomatch",
127128
"//:node_modules/@types/semver",
128-
"//:node_modules/@types/watchpack",
129129
"//:node_modules/esbuild",
130130
"//:node_modules/esbuild-wasm",
131131
"//:node_modules/karma",

‎packages/angular/build/package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@
4343
"source-map-support": "0.5.21",
4444
"tinyglobby": "0.2.17",
4545
"vite": "8.1.5",
46-
"watchpack": "2.5.2"
46+
"@parcel/watcher": "2.5.1",
47+
"chokidar": "4.0.3"
4748
},
4849
"optionalDependencies": {
4950
"lmdb": "3.5.6"

‎packages/angular/build/src/builders/application/build-action.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export async function* runEsBuildBuildAction(
113113

114114
// Setup a watcher
115115
const { createWatcher } = await import('../../tools/esbuild/watcher');
116-
watcher = createWatcher({
116+
watcher = await createWatcher({
117117
polling: typeof poll === 'number',
118118
interval: poll,
119119
followSymlinks: preserveSymlinks,

0 commit comments

Comments
 (0)