-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Description
Versions
- nuxt: nuxt3@3.0.0-27276275.abfbd2f
- node: 14.17.0
Reproduction
In short, the issue is that CSS from different pages & layouts is included on all pages, resulting in pages being styled incorrectly. This only happens in dev mode in Nuxt 3 – when building for prod, the CSS is included as expected.
I've set up a repo that shows the issue (and goes through the expected and actual behaviour).
A similar issue was reported for Nuxt 2, where one of the team said that the issue would be looked at for Nuxt 3 – which is why I set up this test repo, as we're seeing this issue on our project.
Steps to reproduce
- Check out this repo
- Go to the
nuxt3-appfolder in command line, install dependencies (yarn) and runyarn devto reproduce the issue. - The test site has 4 pages –
/,/search,/menuand/checkout– and the expected/actual results are documented in the README of the repo.
What is Expected?
When rendering a page, styles from irrelevant layouts and other pages do not also load on the page.
What is actually happening?
Currently, in dev mode, it looks like all styles from all layouts and pages are included in the head of each page, resulting in issues with the page displaying styles that aren't intended for the current page.