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

Disabling SSR prevents remaining CSS from loading #27387

Closed
hichem-dahi opened this issue May 28, 2024 · 5 comments
Closed

Disabling SSR prevents remaining CSS from loading #27387

hichem-dahi opened this issue May 28, 2024 · 5 comments

Comments

@hichem-dahi
Copy link

hichem-dahi commented May 28, 2024

Environment

  • Operating System: Linux
  • Node Version: v18.20.2
  • Nuxt Version: 3.11.2
  • CLI Version: 3.11.1
  • Nitro Version: 2.9.6
  • Package Manager: npm@10.5.0
  • Builder: -
  • User Config: ssr, css, devtools, modules, colorMode
  • Runtime Modules: @nuxt/ui@2.16.0, @pinia/nuxt@0.5.1, @vueuse/nuxt@10.9.0
  • Build Modules: -

Reproduction

https://stackblitz.com/~/github.com/hichem-dahi/trello-nuxt

Describe the bug

Setting ssr: false in nuxt config prevents remaining CSS from loading.

Additional context

Works fine for Firefox 126.0 (64-bit), doesn't work for Chrome 125.0.6422.60 (Official Build) (64-bit).
Screenshot from 2024-05-28 12-14-45
Screenshot from 2024-05-28 12-15-21

Logs

No response

@nuxtbot nuxtbot changed the title Disabling ssr and setting a nuxt/ui background class in parent tag prevents remaining CSS from loading "Disabling SSR and setting a Nuxt/UI background class in parent tag prevents remaining CSS from loading" May 28, 2024
@hichem-dahi hichem-dahi changed the title "Disabling SSR and setting a Nuxt/UI background class in parent tag prevents remaining CSS from loading" "Disabling SSR prevents remaining CSS from loading" May 28, 2024
@hichem-dahi hichem-dahi changed the title "Disabling SSR prevents remaining CSS from loading" Disabling SSR prevents remaining CSS from loading May 28, 2024
@manniL
Copy link
Member

manniL commented May 28, 2024

Can you double-check if that also happens on nightly?

@hichem-dahi
Copy link
Author

@manniL same issue.

  • Nuxt Version: 3.12.0-28613622.d1ac12c9

@hichem-dahi
Copy link
Author

I cleared the cache and now it's working fine!

@Ragura
Copy link

Ragura commented Jun 13, 2024

I can confirm this is indeed a cache invalidation problem. Once solved by clearing/disabling cache, it remains solved, but it's kind of weird that it occurs in the first place. In my case I had it happen when importing css from font-awesome while srr: true, then changing it to ssr: false which caused the cache problem. Not a big deal in this case, but it might be an indicator of other caching issues that could be hard to debug.

@danielroe
Copy link
Member

Ahh, this is likely due to a Vite issue - IIRC, in some situations css is imported as JavaScript (which is executed and injects the CSS) vs a CSS file. There have been issues with setting the appropriate cache headers.

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

No branches or pull requests

4 participants