-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
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
Non-Deterministic CSS ordering for extracted CSS in an SSR App #8825
Comments
I think the only workaround available at the moment is to set |
that problem was fixed in v2.5.18-beta.0 - #7902
I have the same issue in 2.5.22 |
This seems to have been resolved for me in 2.5.22 but another issue has surfaced. I have updated the reproduction repo to show the new issue.
However, on 2.5.22, the bundle renderer includes 2 I am going to upgrade the reproduction repo to the latest 2.6 release now and see if that changes anything. |
Still seeing the same issue in 2.6.6 - the dev builds include two I will need to dig in further as to what's different in my app such that the bundler renderer gives us two |
@brophdawg11 |
Version
2.5.17
Reproduction link
https://github.com/brophdawg11/vue-ssr-css-ordering
Steps to reproduce
Reproduction steps are outlined in the README in the github repo.
What is expected?
In both development and production builds, the extracted CSS stylesheets should be loaded in a deterministic order.
I believe from reading various semi-related github issues that the order corresponds with the import order via webpack. If that is the case for SSR as well, I would expect the order to be
app.css -> home.css -> about.css
since theApp.vue
file is loaded statically, andHome.vue
andAbout.vue
are loaded dynamically via routes in that order.Either way, I would expect global styles from
App.vue
to always be loaded first, followed by dynamic-route styles, allowing for a proper cascade.What is actually happening?
I think there are two issues at play:
Primary Issue: In development mode, the
app.css
file is incorrectly loaded after theabout.css
file, breaking the cascade for contents ofAbout.vue
.Secondary Issue: In production mode, the
app.css
file is properly loaded first, but thenabout.css
is loaded prior tohome.css
even though they are imported in the reverse order and even when SSR-ing the home page.Additional Notes
I'm trying to determine what feels like the optimal solution, and I think there are a few options, in a loose descending order of "optimal", and likely increasing order of feasibility:
App.vue
component would always be loaded first, followed by the only the styles for the component matched for the current route. Additional route-specific styles would be loaded on demand when routing. I understand this is likely beyond the scope of the bundle renderer and potentially something to be implemented by the application itself.App.vue
component would always be loaded first, followed by styles for the current route-component, followed by styles for additional route-components.App.vue
component would always be loaded first, followed by styles for route-level components, in import-order (i.e., in route-declaration order)It is also worth noting that my specific scenario in my larger app is slightly different, but I wasn't able to quite reproduce it exactly in this minimal repo, and I'm not quite sure why. In my specific app case, I have an
App.vue
and 3 dynamic routes defined in the order:In development mode, my stylesheets are included in the order: page1, app, home, page2.
In production mode, my stylesheets are included in the order: home, page1, page2, app
So in the demo repo, the production build is correct insofar as it doesn't break the cascade for either route, and the development build is incorrect for only one of the routes.
In my actual app, the development mode only breaks the cascade for the page1 route, while the production build breaks it for all routes.
The text was updated successfully, but these errors were encountered: