Skip to content

Conversation

@bradlc
Copy link
Contributor

@bradlc bradlc commented Oct 13, 2021

This PR configures the awaitWriteFinish setting for chokidar.watch on Windows. From the chokidar documentation:

[...] in some cases some change events will be emitted while the file is being written. In some cases, especially when watching for large files there will be a need to wait for the write operation to finish before responding to a file creation or modification.

The exact settings (stabilityThreshold: 50, pollInterval: 10) are based on those used by postcss-cli: https://github.com/postcss/postcss-cli/blob/master/index.js#L125-L128

When looking into #5753 I observed that occasionally a file read will return an empty string on Windows, even when the file has contents. This can cause new classes to be missed. Configuring awaitWriteFinish helps to avoid this by delaying the change event until the file size has not change for 50ms. I was not able to reproduce the empty string issue with awaitWriteFinish configured as per this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants