Skip to content

Commit a3049e6

Browse files
authored
Configure awaitWriteFinish for chokidar (#5758)
* Configure `awaitWriteFinish` for chokidar * Enable `awaitWriteFinish` on Windows only
1 parent dbe797d commit a3049e6

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/cli.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,13 @@ async function build() {
734734

735735
watcher = chokidar.watch([...contextDependencies, ...extractFileGlobs(config)], {
736736
ignoreInitial: true,
737+
awaitWriteFinish:
738+
process.platform === 'win32'
739+
? {
740+
stabilityThreshold: 50,
741+
pollInterval: 10,
742+
}
743+
: false,
737744
})
738745

739746
let chain = Promise.resolve()

src/jit/lib/setupWatchingContext.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,13 @@ function rebootWatcher(context, configPath, configDependencies, candidateFiles)
8484

8585
watcher = chokidar.watch([...candidateFiles, ...configDependencies], {
8686
ignoreInitial: true,
87+
awaitWriteFinish:
88+
process.platform === 'win32'
89+
? {
90+
stabilityThreshold: 50,
91+
pollInterval: 10,
92+
}
93+
: false,
8794
})
8895

8996
setWatcher(context, watcher)

0 commit comments

Comments
 (0)