From 0108dbbbda4cdf1de2b1e9820b42c02775af9f36 Mon Sep 17 00:00:00 2001 From: Brad Cornes Date: Mon, 11 Oct 2021 16:28:22 +0100 Subject: [PATCH 1/2] Configure `awaitWriteFinish` for chokidar --- src/cli.js | 4 ++++ src/jit/lib/setupWatchingContext.js | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/cli.js b/src/cli.js index 0c05a30d6e09..061d6da7b76e 100644 --- a/src/cli.js +++ b/src/cli.js @@ -734,6 +734,10 @@ async function build() { watcher = chokidar.watch([...contextDependencies, ...extractFileGlobs(config)], { ignoreInitial: true, + awaitWriteFinish: { + stabilityThreshold: 50, + pollInterval: 10, + }, }) let chain = Promise.resolve() diff --git a/src/jit/lib/setupWatchingContext.js b/src/jit/lib/setupWatchingContext.js index edbf5fba5e6f..7fd2d815af9b 100644 --- a/src/jit/lib/setupWatchingContext.js +++ b/src/jit/lib/setupWatchingContext.js @@ -84,6 +84,10 @@ function rebootWatcher(context, configPath, configDependencies, candidateFiles) watcher = chokidar.watch([...candidateFiles, ...configDependencies], { ignoreInitial: true, + awaitWriteFinish: { + stabilityThreshold: 50, + pollInterval: 10, + }, }) setWatcher(context, watcher) From 32e1c7b4a0f50cf0963e582b0d65188bd3bccac7 Mon Sep 17 00:00:00 2001 From: Brad Cornes Date: Wed, 13 Oct 2021 12:43:31 +0100 Subject: [PATCH 2/2] Enable `awaitWriteFinish` on Windows only --- src/cli.js | 11 +++++++---- src/jit/lib/setupWatchingContext.js | 11 +++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/cli.js b/src/cli.js index 061d6da7b76e..34e116e212e1 100644 --- a/src/cli.js +++ b/src/cli.js @@ -734,10 +734,13 @@ async function build() { watcher = chokidar.watch([...contextDependencies, ...extractFileGlobs(config)], { ignoreInitial: true, - awaitWriteFinish: { - stabilityThreshold: 50, - pollInterval: 10, - }, + awaitWriteFinish: + process.platform === 'win32' + ? { + stabilityThreshold: 50, + pollInterval: 10, + } + : false, }) let chain = Promise.resolve() diff --git a/src/jit/lib/setupWatchingContext.js b/src/jit/lib/setupWatchingContext.js index 7fd2d815af9b..0b20f8bd6d34 100644 --- a/src/jit/lib/setupWatchingContext.js +++ b/src/jit/lib/setupWatchingContext.js @@ -84,10 +84,13 @@ function rebootWatcher(context, configPath, configDependencies, candidateFiles) watcher = chokidar.watch([...candidateFiles, ...configDependencies], { ignoreInitial: true, - awaitWriteFinish: { - stabilityThreshold: 50, - pollInterval: 10, - }, + awaitWriteFinish: + process.platform === 'win32' + ? { + stabilityThreshold: 50, + pollInterval: 10, + } + : false, }) setWatcher(context, watcher)