-
-
Notifications
You must be signed in to change notification settings - Fork 349
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
vanilla-extract missing CSS with HTML-only rendering (in dev only) #538
Comments
I could reproduce indeed. Although I sometimes couldn't reproduce and I needed to restart the server to be able to reproduce again. I'd guess it's some kind of race condition between Vite picking up the CSS dependency and VE's generation of CSS. Vite automatically injects the CSS, so it's not really a VPS thing. (Note that The only thing VPS does here is to collect the CSS dependencies to avoid FOUC: https://github.com/brillout/vite-plugin-ssr/blob/main/vite-plugin-ssr/node/renderPage/getPageAssets/retrieveAssetsDev.ts. You can dig into this file ( While I think it's probably unrelated to VPS, maybe there is a possible workaround on VPS's side. |
ok didnt know that about yes retrievePageAssets is one of the 3 places that I stumbled upon yesterday and thought that could help, I also found:
I have no idea what to do with that tho
so I guess we can close this unless you want to make a workaround on VPS's side too ? |
This really seems more like a VE thing than a VPS thing. So let's close this. Let me know if you believe there is anything VPS can do here. Btw. in case your company would be up for it: https://github.com/sponsors/brillout. |
@astahmer hey have you opened a PR or bug on the VE repository? Running in the same issue here and would prefer having VE supporting that instead of writing the plugin on my own 😬 |
Did you move the example? Your links gives a 404. Thanks for the example! We should add it to the community example list. |
yeah sorry, I updated the comment above with a permalink instead btw i'll soon open another issue, this time I fixed it directly in VPS here not much details but as a summary: this is due to |
I see, looking forward to it. (FYI we may not even need that with vitejs/vite#11430. But it may take a while until the PR is merged, so let's go for your proposed fix in the meantime.) |
@brillout Even after vitejs/vite#11430 got merged, it looks like this is still happening. |
@airtonix Can you make it minimal starting from one of the boilerplates ( |
@brillout this is already based on one of those templates. |
@airtonix I guess that This won't work if you import Importing real CSS from (I didn't run your reproduction, but I can do so if you remove all frivolous/unknown dependencies from |
Description
Hey, first I wanted to thank you for all your work, i'm very glad to see how far VPS has got and also excited to see where it's going (especially the single file RFC 👀 ) !
Context:
sprinkles
packagevite build
+vite preview
it (VE in SSR in dev) works fine with other frameworks (rakkas/qwik/next, havent tried others) or others rendering modes of VPS, which makes me think this might be a VPS problem
i've been digging a lot today and couldn't find a way to fix this in the VE-plugin, i'm no expert in making vite plugin so it might also just be me not being good enough in that field
Steps to reproduce
minimal repro
zero-js
page, see there the CSS is there, everything is ok (even tho this line was forced to true, was needed in the VE plugin, without it there was no CSS at all for the HTML-only page..)with-js
page, everything is still finezero-js
page, the CSS for that page is gone and won't ever come back unless completely stop+restarting the vite dev serverthis is what happens :
Workaround
I have found a workaround, with this the CSS will not be missing when using HTML-only pages (
.page.server
+ssr({ includeAssetsImportedByServer: true})
)this is what happens when I use a .page.client & dynamic import the sprinkles manually in dev mode only, what expected would happen :
please tell me if there's anything I can do to help !
Error Message + Error Stack
No response
The text was updated successfully, but these errors were encountered: