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

vite: Fix stale CSS emit by invalidating all modules #1066

Merged
merged 2 commits into from
Apr 17, 2023

Conversation

askoufis
Copy link
Contributor

Sort of addresses #925. As mentioned in the issue, sometimes a single file ID is associated with more than 1 module, but we were only only invalidating the first module when a change in CSS was detected. This resulted in stale CSS that would only update with a server restart.

In the case of qwik, 2 modules are returned during the CSS invalidation step, one that matches the file ID, and a 2nd one that has the ?direct param on it, which I think has something to do with vite's SSR mode, though I'm not particularly knowledgeable on that front, and I can't find any explicit documentation about it. I do however believe that this new behaviour of invalidating all modules is more correct than before.

This fix results in a page reload and up-to-date CSS, but doesn't go as far as to implement CSS HMR, nor do I think it is the responsibility of the VE plugin to do so.

@changeset-bot
Copy link

changeset-bot bot commented Apr 17, 2023

🦋 Changeset detected

Latest commit: b0f456c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@vanilla-extract/vite-plugin Patch

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

@mattcompiles mattcompiles enabled auto-merge (squash) April 17, 2023 12:27
@mattcompiles mattcompiles merged commit 0d0ea39 into master Apr 17, 2023
@mattcompiles mattcompiles deleted the invalidate-all-modules branch April 17, 2023 12:33
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.

3 participants