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 + router + tailwind JIT -> full page reload #4150
Comments
I'm sorry, I have no idea what happened! The code that was pushed is not the right one at all... Please take a look here: |
I have the same issue with React and tailwind JIT, while using |
Seeing this issue without |
Similar issue here, using When saving a component, in almost all cases the CSS will not be updated. HTML is being updated with HMR, but CSS is not. Weirdly, in very few cases, CSS will be properly updated but I can't see a pattern that would explain why. I have to go save |
In this repo |
@patak-js Excuse me, can this bug be reproduced on your side? |
There should be an issue with the reproduction provided by @jods4, as it is using 2.3.3 as you said. @jods4 could you check your repro? |
@OneNail I double-checked, and as can be shown in System info, npm restored vite 2.4.1 on my machine as it satisfies ^2.3.3. Check this, you can see Vite version (2.4.1) and the full page reloads instead of HMR: |
The same problem, not yet found the cause |
Using Vite + Tailwind JIT + React. Same problem |
Could you provide a mini repo to check the problem? Thanks |
Same issue starting Here is a very simple test case : https://github.com/paraboul/vue-hmr-reload Removing tailwind (along with the postcss config and stuff in |
I tried to revert 09c6c94 locally, hmr triggers on Edit: HMR is broken with tailwindcss (jit mode) since 2.3.7 (component simply won't update). Edit 2: After editing This is the object received by
I'm not sure why IIUC, tailwind tells postcss to register all the purgeable files as a dependencies and so this is being called : This precise case could be fixed by importing I'm laking a bit of context here to go forward with a fix. Edit 4 : Overall it seems that the issue is that Tailwind (JIT) generated css ( |
So it seems that the moduleGraph contains 2 entries for the SFC being updated :
Then during Ultimately a force page reload is invoked according to this code : vite/packages/vite/src/node/server/hmr.ts Lines 247 to 255 in 887c247
|
My guess is the original issue lies somewhere where the SFC module is registered twice with different URL and differents importers (absolute with |
As an interim solution, downgrading to |
@eugene1g |
Same issue here with And additional observation: When you enable |
This is further confirmation for #4267, because the order in which modules are emcountered can mask tge bug. @lhermann Could you try to yarn link vite with this PR to check that the issue is resolved for you? |
@patak-js could you elaborate what you mean by "yarn link vite with this PR"? I'm afraid I don't quite understand. |
@patak-js thanks, learned something new today. I linked #4267 and can confirm that it resolves the issue, HMR works as expected 🎉 |
Describe the bug
Follow up of #4147 , when editing Vue templates, I get full page reload instead of HMR.
Reproduction
https://github.com/jods4/bug-vite-tailwind/
Go into HelloWorld.vue, change the class
bg-yellow-400
intobg-green-400
.Notice on the terminal or in the browser that vite triggered a full page reload. I'd expect HMR here.
I first tried without Vue router and it worked, so I'm not sure where the problem lies exactly.
System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: