-
Notifications
You must be signed in to change notification settings - Fork 297
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: support HMR #925
vite: support HMR #925
Conversation
🦋 Changeset detectedLatest commit: b21f3b7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
5cc6217
to
a42b9de
Compare
What's pending here? This would majorly help us. |
Hey @wmertens 👋 This PR implies that we don't currently support HMR in Vite but that's not true. Are you able to provide a reproduction of the issue that's being resolved here? When testing locally, HMR seems to work fine so I'm not sure why it doesn't work in your scenario? Also sorry, I know this PR has been open for a while. |
@mattcompiles The problem is |
Waiting on this as well. |
@wsow4 Thanks for jumping in, I don't doubt you. Just without a reproduction to test against how can we say something has been resolved? If someone provides a reproduction of this issue we will definitely try get it resolved ASAP. |
@mattcompiles Try changing the text color in https://stackblitz.com/edit/qwik-starter-r2tt19?file=src/routes/styles.css.ts - it only works when you restart the server Note that it's not doing hot reload, just reload. |
@wmertens Thanks bud. I'll take a look. |
@wmertens Implementing the fix mentioned by @wsow4 where we invalidate all modules returned by I think the crux of the issue here is that the Vanilla Extract vite plugin handles HMR for vanilla modules, but it does not handle HMR for plain If I'm understanding it correctly, you've effectively implemented HMR for emitted CSS. IMO this shouldn't be the responsibility of the Vanilla Extract vite plugin, but rather the qwik vite plugin. In fact, I'm assuming it already has some kind of support for CSS HMR already, so maybe what's needed is some extra logic to handle CSS emitted by vanilla. |
@askoufis no, this PR doesn't implement CSS hot reload, it only re-parses the .css.ts file when it should be, but your solution is more elegant. Closing. |
With this change, hot reload works in Qwik and presumably anything else using Vite.
The problem was that a change in css.ts didn't force a regen of the CSS.