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
inlineSSRStyles
option causes duplication of CSS
#21821
Comments
Start a new pull request in StackBlitz Codeflow. |
Updated reproduction, still reproducible in v3.7: https://stackblitz.com/edit/github-nk3n5b-sex9hu?file=package.json |
@danielroe any ideas? |
I think this is a limitation of the current inlining style implementation. Styles used everywhere on your app could safely be removed entirely from CSS source directly. But CSS used only in one component or a page need to be located in a CSS file as well as inlined. At the moment, vite is in charge entirely of loading CSS on the client side which means that even if we did track what CSS was already loaded, we can't stop vite from loading the CSS files which contain duplicated CSS. This is something I definitely want to see fixed. |
Yes, and this can remove the order of style so reset CSS can be applied after real CSS. |
Do I understand correctly that with the Is there anything we can do about this without turning off the Below is a link to reproduce duplicate styles at the https://stackblitz.com/edit/github-g4givn?file=app.vue,package.json,components%2FButton.vue |
@zavvla The configuration option is now under the |
I spent a lot of time trying to solve this strange behavior. Duplication of styles is a major performance issue. |
Having in-line styles help to have a better first rendering since there is no needs for the ccs files to be load before having styles. That's a compromise between visual rendering and global weight. |
Is there any news on this? Fix this for large projects with bigs css like designs systems, etc it is very important. |
Another aspect which amplifies the effects even more is that stuff like |
Environment
Nuxi 3.6.1
RootDir: /home/projects/github-nk3n5b
Nuxt project info:
Reproduction
https://stackblitz.com/edit/github-nk3n5b?file=app.vue
Describe the bug
Inlined CSS files are also loaded from
link
tag, which cause duplication of CSS. This problem occurs only if SSR is enabled (afternuxi build
ornuxi generate
), doesn't happen innuxi dev
.I guess
inlineSSRStyles
option is for the performance improvements, but this behavior wipes out the benefit. (HTML is bloated a bit, browser still fetches render-blockign CSS, and that's all)Additional context
Maybe related to #21762
Logs
No response
The text was updated successfully, but these errors were encountered: