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
All pages styles are being bundled and delivered #26987
Comments
Would you be able to provide a reproduction? 🙏 More infoWhy do I need to provide a reproduction?Reproductions make it possible for us to triage and fix issues quickly with a relatively small team. It helps us discover the source of the problem, and also can reveal assumptions you or we might be making. What will happen?If you've provided a reproduction, we'll remove the label and try to reproduce the issue. If we can, we'll mark it as a bug and prioritize it based on its severity and how many people we think it might affect. If How can I create a reproduction?We have a couple of templates for starting with a minimal reproduction: 👉 https://stackblitz.com/github/nuxt/starter/tree/v3-stackblitz A public GitHub repository is also perfect. 👌 Please ensure that the reproduction is as minimal as possible. See more details in our guide. You might also find these other articles interesting and/or helpful: |
https://vitejs.dev/config/build-options#build-csscodesplit Setting css code split to false force vite to not split css by chunk and merge thel into a single css file. |
Hey @huang-julien , The default behavour should be for each component / page there should be a style file , but in case of using .server.vue on pages, it just inlines the styles into the html. I wouldn't mind on going with that, but I saw other side effect with it, which I linked above. |
Environment
Nuxt: 3.11
Bundler: vite
Css Preprocessor: less
Reproduction
Createa a brand new project, 2 layouts, several pages*.server.vue. All of the layouts / pages should have styles inside. After building the project, going to a single layout -> page, all of the styles of all pages /layouts are being delivered.
Describe the bug
Using Nuxt 3 SSR mode, with all pages being .server.vue deliveres by default inline styles only.
This issue is whenever we add:
vite: { build: { cssCodeSplit: false, }, }
With this config and .server.vue, there is a single styles.css file delivered, which contains all of the styles withing pages/ pages*.server.vue.
I also have /layouts folder, it also combines all of the styles from the layouts.
So the styles.css file, contain a lot of unused and conflicting styles. Before, with nuxt 2/ webpack I didn't have those issues at all. I was using inline styles and only the needed ones were delivered.
There is also an issue with the inlined-styles on the child components, which are using typescript. #25923
Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: