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

HMR weirdness with Astro + Uno #2812

Closed
4 tasks done
marvin-j97 opened this issue Jun 29, 2023 · 9 comments · Fixed by #2989
Closed
4 tasks done

HMR weirdness with Astro + Uno #2812

marvin-j97 opened this issue Jun 29, 2023 · 9 comments · Fixed by #2989
Labels

Comments

@marvin-j97
Copy link

marvin-j97 commented Jun 29, 2023

UnoCSS version

0.53.4

Describe the bug

There are a couple of issues I have noticed trying to use the latest versions of Astro and Uno. I'm not sure if all these problems are caused by Uno, downgrading to Astro ^2.6 (from 2.7.2) fixes it. But I'm not sure if Astro is at fault here.

  1. Running dev mode, the first thing you see the web page is completely unstyled. Refreshing fixes it.

  2. Uno logs "[unocss-hmr] failed to get unocss hash, hmr might not work"

  3. Now, changing some classes, the site sometimes reverts to the unstyled version (I think this happens when a previously unused class is used). Using one that has been used before is fine.

Production build is fine.

Reproduction

https://github.com/marvin-j97/astro-uno-hmr

System Info

Ubuntu, Chrome

Validations

@marvin-j97 marvin-j97 changed the title Problems with Astro + Solid Problems with Astro + Uno Jun 29, 2023
@marvin-j97 marvin-j97 changed the title Problems with Astro + Uno HMR weirdness with Astro + Uno Jun 29, 2023
@Dunqing
Copy link
Member

Dunqing commented Jul 1, 2023

It looks like Astro did some updates that caused this problem, I tested it and it occurs from 2.7.1 onwards.

@Dunqing
Copy link
Member

Dunqing commented Jul 1, 2023

I confirmed that it is caused by withastro/astro#7381, I am not sure if I want to fix it in astro or in unocss, can you report this issue to astro?

@marvin-j97
Copy link
Author

Maybe it's related to withastro/astro#7529 ?

@Dunqing
Copy link
Member

Dunqing commented Jul 1, 2023

Maybe it's related to withastro/astro#7529 ?

Yes, but it should have been broken since 2.7.1.

@marvin-j97
Copy link
Author

marvin-j97 commented Jul 6, 2023

HMR is supposedly fixed (haven't tried yet) in Astro 2.7.4.

The uno hash warning still comes up:
withastro/astro#7565 (comment)

@marvin-j97
Copy link
Author

Can confirm HMR is working in Astro 2.8.0.

uno hash warning still popping up, not sure if it's important:
https://stackblitz.com/edit/withastro-astro-yrtpg7?file=package.json

@Dunqing
Copy link
Member

Dunqing commented Jul 10, 2023

I don't think this warning affects HMR, but I'll try to fix it.

@GavinXue
Copy link

This uno hash warning still popping up. Sometimes the hmr works, and sometimes not. Still need to refresh page to check the new style.
unocss@0.53.6 astro@2.9.2

@JUNGHUNKIM-7
Copy link

The issue is existing until today. "astro": "^2.10.1", "unocss": "^0.54.2"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants