-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Styles are added to head in wrong order in prod #5462
Comments
Happening to us as well! Watching in case we can provide additional detail as a discussion around this continues. |
@wulinsheng123 thanks for taking a look, I just tested again in a fresh |
I used |
Did you try cloning the project and building it locally, without gitpod? |
@wulinsheng123 @jasikpark can either of you reproduce in a standard environment? Running in gitpod could be a confounding factor. |
I will try late. Recently I have had a little busy |
same |
Thanks, there must be some tricky caching going on in my end. Rats. This is a tough one to reproduce. |
OK, After some more work, I found that adding a postcss config file that adds autoprefixer causes the issue to reproduce. To break caching, it's necessary to change the project folder name, and rebuild. And I've been using Would y'all mind pulling the latest commit from my reproduction (maybe clone it into a new folder?) and trying again? |
i would expect gitpod to be amenable to a local linux build since it's a full remote box rather than something esoteric like stackblitz, tho ig it's always good to remove confounding variables |
was able to reproduce with the commit that contained autoprefixer and postcss https://pr.new/https://github.com/IanVS/astro-style-order-reproduction |
Do you copy his code directly into the Stackblitz? |
OK, I got it. Why happens in production |
I need some clarification. The primary reasons will cause this bug. I found it. |
Thanks so much for looking into this @wulinsheng123! Crossing my fingers for a fix, or at the very least a workaround, since this issue is blocking us from adding a new page to our site. |
I'm looking into this now. |
Thanks for the tip about global css too @matthewp - setting up import sorting to always throw the Layouts and MainHead at the top of our imports has mostly fixed the global css cascade problem |
So the issue here is that the sort order only takes into account the order within the page component. I think what it should be is a sum of all sort orders from each module going all the way down. Will try and see if that can fix it. |
That does indeed fix it, let me see if I can turn this example into a test. |
Fix is in #5549 |
What version of
astro
are you using?1.6.10
Are you using an SSR adapter? If so, which one?
no
What package manager are you using?
npm
What operating system are you using?
mac
Describe the Bug
I got bitten by a really strange error when trying to add a new page to our site. The hamburger button in the top nav started showing up in desktop sizes, but only in production builds. I traced it down to an issue in the order that styles were being added to the
head
, global styles were being added after component styles. I've created as minimal of a reproduction that I could, hopefully it's helpful.I've noticed a lot of times where the styles in dev don't match production, which is pretty concerning, so I'm hopeful that this reproduction can expose an issue that can be solved and might help bring dev and prod builds more into line.
Link to Minimal Reproducible Example
https://github.com/IanVS/astro-style-order-reproduction
Participation
The text was updated successfully, but these errors were encountered: