Skip to content

Commit

Permalink
Configure awaitWriteFinish for chokidar (#5758)
Browse files Browse the repository at this point in the history
* Configure `awaitWriteFinish` for chokidar

* Enable `awaitWriteFinish` on Windows only
  • Loading branch information
bradlc committed Oct 13, 2021
1 parent dbe797d commit a3049e6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/cli.js
Expand Up @@ -734,6 +734,13 @@ async function build() {

watcher = chokidar.watch([...contextDependencies, ...extractFileGlobs(config)], {
ignoreInitial: true,
awaitWriteFinish:
process.platform === 'win32'
? {
stabilityThreshold: 50,
pollInterval: 10,
}
: false,
})

let chain = Promise.resolve()
Expand Down
7 changes: 7 additions & 0 deletions src/jit/lib/setupWatchingContext.js
Expand Up @@ -84,6 +84,13 @@ function rebootWatcher(context, configPath, configDependencies, candidateFiles)

watcher = chokidar.watch([...candidateFiles, ...configDependencies], {
ignoreInitial: true,
awaitWriteFinish:
process.platform === 'win32'
? {
stabilityThreshold: 50,
pollInterval: 10,
}
: false,
})

setWatcher(context, watcher)
Expand Down

0 comments on commit a3049e6

Please sign in to comment.