Skip to content

Commit 7ccc210

Browse files
committed
fix(@angular-devkit/build-angular): handle watch updates on Mac OSX when using native FSEvents API
By default, on Mac OSX chokidar will use the native darwin FSEvents API unless polling is enabled. In which case instead of listening on `raw` events we need to listen to `all` events.
1 parent 4bcee31 commit 7ccc210

File tree

1 file changed

+2
-2
lines changed
  • packages/angular_devkit/build_angular/src/tools/esbuild

1 file changed

+2
-2
lines changed

packages/angular_devkit/build_angular/src/tools/esbuild/watcher.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export function createWatcher(options?: {
9898
* ... (Nothing)
9999
* ```
100100
*/
101-
watcher.on('raw', (event, path, { watchedPath }) => {
101+
watcher.on(watcher.options.useFsEvents ? 'all' : 'raw', (event, path, metadata) => {
102102
switch (event) {
103103
case 'add':
104104
case 'change':
@@ -108,7 +108,7 @@ export function createWatcher(options?: {
108108
case 'rename':
109109
// When polling is enabled `watchedPath` can be undefined.
110110
// `path` is always normalized unlike `watchedPath`.
111-
const changedPath = watchedPath ? normalize(watchedPath) : path;
111+
const changedPath = metadata?.watchedPath ? normalize(metadata.watchedPath) : path;
112112
currentEvents ??= new Map();
113113
currentEvents.set(changedPath, event);
114114
break;

0 commit comments

Comments
 (0)