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

Only handle '.css' files in writeFile #173

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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

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.

None yet

1 participant