Open Netail opened 7 months ago
cc: @sokra as you've worked a lot on the CSS bundling part
https://github.com/vercel/next.js/pull/63157 fixed a big issues we had before, but it seems like there's still an issue left regarding the css order when using both client & server components :(
I think this is also related and is a critical bug: https://github.com/vercel/next.js/issues/64773
I think this is also related and is a critical bug: https://github.com/vercel/next.js/issues/64773
Agreed on this being a critical bug, because this has huge impact on css rendering.
A bit more info found here; https://github.com/vercel/next.js/issues/51030#issuecomment-2220507886
Is there any more info about this issue? I'm currently on 14.2.0.canary.28 but I'm still having issue CSS ordering issues when using Client components.
Link to the code that reproduces this issue
https://github.com/Netail/repro-app-dir-css-order
To Reproduce
yarn dev
& openlocalhost:3000
navigation-wrapper.tsx
Current vs. Expected behavior
CSS streaming of client components mess with the order of the css bundle, resulting in being appended later and thus overriding certain server side styling.
In the example it should stay a yellow and blue component instead of 2 blue components when uncommenting 'use client'.
It seem like the page.css overwrites css from the layout.css due to importing order issues. Some classes which get streamed to page.css are already in layout.css, maybe a check could be built in if they were already present in the layout.css bundle?
Provide environment information
Which area(s) are affected? (Select all that apply)
Webpack
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
No response