Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure awaitWriteFinish for chokidar #5774

Merged
merged 2 commits into from
Oct 13, 2021
Merged

Configure awaitWriteFinish for chokidar #5774

merged 2 commits into from
Oct 13, 2021

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.

1 participant