From 62628ab00912748c8d8296976f95c67f092c8d10 Mon Sep 17 00:00:00 2001 From: Jason Jean Date: Tue, 20 Jun 2023 18:11:50 -0400 Subject: [PATCH] fix(core): filter batches of outputs changes properly (#17697) --- packages/nx/src/daemon/server/watcher.ts | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/packages/nx/src/daemon/server/watcher.ts b/packages/nx/src/daemon/server/watcher.ts index 3c1ce15fca558..163a4e1e2fcc8 100644 --- a/packages/nx/src/daemon/server/watcher.ts +++ b/packages/nx/src/daemon/server/watcher.ts @@ -102,16 +102,15 @@ export async function watchOutputFiles(cb: FileWatcherCallback) { return cb(err, null); } - for (const event of events) { - if ( - event.path.startsWith('.git') || - event.path.includes('node_modules') - ) { - return; - } + events = events.filter((event) => { + return ( + !event.path.startsWith('.git') && !event.path.includes('node_modules') + ); + }); + + if (events.length !== 0) { + cb(null, events); } - - cb(null, events); }); return watcher; }