-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
fix: add caching to PostCSS for regular stylesheets #6505
Conversation
🦋 Changeset detectedLatest commit: 8f8c3aa The changes in this PR will be included in the next version bump. This PR includes changesets to release 18 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the cache abstraction, should serve us well.
🤖 Hello there, We just published version Thanks! |
🤖 Hello there, We just published version Thanks! |
🤖 Hello there, We just published version Thanks! |
For now this is focused on regular stylesheets. Future PRs will extend this to more PostCSS touch points.
This PR introduces a generic file watch cache that can be used to cache async file processing and invalidate cache entries whenever relevant files are changed. I've integrated this into both old and new dev servers, and for consistency I've also integrated it into the build process so that plugins don't need to behave differently between dev and build and can always assume the presence of the cache.
Note that our watcher logic in
watch.ts
needed to be patched so that watch paths are always absolute. I've added a comment explaining why this is the case, but basically we need to always watch absolute paths so that Chokidar provides absolute paths in change events, which is important to ensure consistent values for the cache.To test this, I've added some more complex PostCSS usage to our HMR test.