-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
FOUC with full reload #8890
Comments
I would like to add to this that it makes working with gsap scrolltrigger nearly impossible, since the absense of style cause the content to jank. Therefore, it triggers animations that are not supposed to get triggered yet |
I ran into this as well and what is happening is because you are loading the css from javascript the browser think it can do the initial render. You can workaround this if you can add a link to the css in the head. Here is your repo with this change https://stackblitz.com/edit/github-9hxcqg?file=src/_includes/head.liquid The css path is a little funky because its relative to |
I'm not sure if there's something to fix here. As Pyrolistical pointed out, you're importing CSS from JS so there's bound to be a short period before the CSS is applied. If Vite has to analyze all the imports to inline into the HTML before responding it, it makes fetching the HTML much slower. Hence the optimization is only applied in builds. |
Describe the bug
My css, which is imported in main.js, is automatically inline in the head of the page when running the dev server. When running vite build and vite preview, it injects a link tag.
When running de dev server I am also experiencing a Flash of unstyled content (FOUC) when the page loads. This is very annoying, since I use vite-plugin-eleventy so rebuilds are a basic part of my dev experience.
I spent a lot of time searching on the web and in the issues, but can't seem to find the problem. It doesn't seem like normal behaviour.
Disclaimer: I'm very new to vite
I made my repo public for reproduction.
Reproduction
https://github.com/silveltman/vite-reproduction
System Info
windows 11 Firefox and Chrome (I tested those 2) Npm 8.11.0 node v16.15.1 Dependencies can be found in the github repo
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: