Skip to content

Conversation

tolu
Copy link

@tolu tolu commented Dec 20, 2021

Description

Chokidar can trigger writeFile for files that glob() does not (see example of issue in screenshot).

In our case, starting watch on pattern packages/**/*.module.css in a monorepo has chokidar trigger for files like:

  • packages/apps/WebApp/node_modules/.bin/lint-staged
  • packages/apps/WebApp/node_modules/.bin/prettier

It seems that the issue is caused by chokidar using glob-parent that handles recursive patterns in a different way than glob.

Solution

Adding an extra precaution that checks .css extension before writing file to skip avoidable error logs.
Not perfect but feels ok to require .css-extension in this module.

Error screenshot

image

tolu added 2 commits December 20, 2021 14:31
Chokidar can trigger `writeFile` for files that `glob()` does not, so add extra precaution here to skip avoidable error logs
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