Skip to content
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

Inconsistent loading order of CSS in dev mode #11946

Closed
Joozty opened this issue Apr 16, 2020 · 16 comments
Closed

Inconsistent loading order of CSS in dev mode #11946

Joozty opened this issue Apr 16, 2020 · 16 comments
Assignees
Milestone

Comments

@Joozty
Copy link

Joozty commented Apr 16, 2020

Bug report

Describe the bug

It's based on #10148 (comment). When _app.jsx contains component which imports postcss module the order of css chunks is inconsistent. Most likely css from module is inserted before global css.

To Reproduce

I created a repo for you https://github.com/Joozty/nextjs-css. It's a fork from #10148. So the steps to reproduce are almost identical.

Expected behavior

CSS in dev mode should be imported/inserted the same way as on production, i.e. global css first and then modules.

Thanks a lot :)

@fabinppk
Copy link

I still have problems with css order too.
I think the comment below is the same problem 🤔

#11901 (comment)

@iksent
Copy link

iksent commented Apr 17, 2020

Maybe I have a similar bug:

  1. I am using Dart SASS: "node-sass": "npm:sass@1.26.2" with @use imports.
  2. Also I am using CSS Modules.
  3. And I tried both Next.js built-in CSS and @zein/next-css with custom config,
  4. Everything works just perfect in development.
  5. But I have a problems with styles in production: some elements displaying not correctly because of different CSS-files importing order or because CSS duplicates (there is no duplicates in dev).

Production (button is visible - its mistake):
prod

Development (button is hidden - its correct):
dev

Just no ideas, how to fix it...

And also there is such a strange thing: styles duplicates appears after HOVERing over the button...
Production:
simple
Production (after hover)
hover

@fabinppk
Copy link

I am installed this version v9.3.6-canary.0 because has a patch to fix css, but didnt resolve to me.

I dont really what it that, but i continuous having duplicates between css chunks and when not, problems with classes order/priority.

@iksent
Copy link

iksent commented Apr 17, 2020

@fabinppk, hello.
I think v9.3.6-canary.0 fixes other problems "Correct Global and Local CSS Loading Order in Dev". No words about avoiding duplicates. And I have no problems is dev, only in production :(

@fabinppk
Copy link

I understand, but the v9.3.6-canary.0 brokers my css in dev mode too, not only in production.

@ashfaqnisar
Copy link

Maybe I have a similar bug:

1. I am using Dart SASS: `"node-sass": "npm:sass@1.26.2"` with `@use` imports.

2. Also I am using CSS Modules.

3. And I tried both Next.js built-in CSS and `@zein/next-css` with custom config,

4. Everything works just perfect in development.

5. But I have a problems with styles in production: some elements displaying not correctly because of different CSS-files importing order or because CSS duplicates (there is no duplicates in dev).

Production (button is visible - its mistake):
prod

Development (button is hidden - its correct):
dev

Just no ideas, how to fix it...

And also there is such a strange thing: styles duplicates appears after HOVERing over the button...
Production:
simple
Production (after hover)
hover

I also have the same issue @iksent, were you able to solve this thing ?

@iksent
Copy link

iksent commented Apr 19, 2020

@ashfaqnisar, no, I’m not. And this is a really big problem...

@ashfaqnisar
Copy link

ashfaqnisar commented Apr 19, 2020

Yup, all the important css components in the production are broken due to this thing. Can we assign a label to this issue @iksent @Joozty

@Timer Timer added this to the 9.3.6 milestone Apr 19, 2020
@Timer
Copy link
Member

Timer commented Apr 22, 2020

This should be fixed in ^9.3.6-canary.9!

@Timer Timer closed this as completed Apr 22, 2020
@Timer Timer self-assigned this Apr 22, 2020
@fabinppk
Copy link

This should be fixed in ^9.3.6-canary.9!

I'm installed the exact version 9.3.6-canary.9 and unfortunately in production mode there are still duplicate css.

I'm using sass, but I don't think that could be the problem.

@iksent
Copy link

iksent commented Apr 23, 2020

Yes, my problem has not been resolved either.
Should we open a new issue, @Timer?
Or maybe move to there: #12099

@bravokiloecho
Copy link

I just upgraded to the stable 9.3.6 and I'm still getting global CSS overrriding CSS from modules (see image below). elements.css is imported in the _app.js

image

@iksent
Copy link

iksent commented Apr 29, 2020

@bravokiloecho, probably, that's because this issue was resolved in 9.3.6-canary.9
(#11946 (comment))

@bravokiloecho
Copy link

@iksent but 9.3.6 was released 7 days after 9.3.6-canary.9 so I assumed it would include everything from that release.

@iksent
Copy link

iksent commented Apr 29, 2020

@bravokiloecho, yes. sorry, my mistake.

@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants