Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): handle watch updates on Mac OSX w…
Browse files Browse the repository at this point in the history
…hen 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.
  • Loading branch information
alan-agius4 committed Dec 1, 2023
1 parent 4bcee31 commit 7ccc210
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export function createWatcher(options?: {
* ... (Nothing)
* ```
*/
watcher.on('raw', (event, path, { watchedPath }) => {
watcher.on(watcher.options.useFsEvents ? 'all' : 'raw', (event, path, metadata) => {
switch (event) {
case 'add':
case 'change':
Expand All @@ -108,7 +108,7 @@ export function createWatcher(options?: {
case 'rename':
// When polling is enabled `watchedPath` can be undefined.
// `path` is always normalized unlike `watchedPath`.
const changedPath = watchedPath ? normalize(watchedPath) : path;
const changedPath = metadata?.watchedPath ? normalize(metadata.watchedPath) : path;
currentEvents ??= new Map();
currentEvents.set(changedPath, event);
break;
Expand Down

0 comments on commit 7ccc210

Please sign in to comment.