Skip to content

Commit

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

* Enable `awaitWriteFinish` on Windows only
  • Loading branch information
bradlc authored Oct 13, 2021
1 parent a7c89c8 commit f599430
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
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,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/lib/setupWatchingContext.js
Original file line number Diff line number Diff line change
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 f599430

Please sign in to comment.