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 css import order between Prod and Dev for Material-UI #15212

Open
figmentc opened this issue Jul 16, 2020 · 2 comments
Open

Inconsistent css import order between Prod and Dev for Material-UI #15212

figmentc opened this issue Jul 16, 2020 · 2 comments
Labels
bug Issue was opened via the bug report template. Webpack Related to Webpack with Next.js.
Milestone

Comments

@figmentc
Copy link

figmentc commented Jul 16, 2020

Bug report

Describe the bug

When using Material-UI components, the import order the related css within output html is not static. This outputs inconsistent styling due to inconsistent overrides.

Affected by three different situations

  1. Whether we are using destructuring to import the components or direct imports
import Button from '@material-ui/core/Button'
import Typography from '@material-ui/core/Typography'

have different results than

import { Button, Typography } from '@material-ui/core'
  1. The order of direct imports
import Button from '@material-ui/core/Button'
import Typography from '@material-ui/core/Typography'

have different results to

import Typography from '@material-ui/core/Typography'
import Button from '@material-ui/core/Button'
  1. Prod vs dev
    yarn dev have different results to yarn build && yarn start

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Clone https://github.com/karpkarp/mui-next-repo
  2. Run in Dev vs Prod to see difference
  3. Change component import in /src/SideNav.component.tsx and run in Prod to see difference
    change
import { Button, Typography } from '@material-ui/core'

to

import Button  from '@material-ui/core/Button'
import Typography from '@material-ui/core/Typography'
  1. Change import order and run in Prod to see difference
import Button  from '@material-ui/core/Button'
import Typography from '@material-ui/core/Typography'

to

import Typography from '@material-ui/core/Typography'
import Button  from '@material-ui/core/Button'

Expected behavior

There an expectation for a static order of css load order on the HTML. The lack of it makes development very tedious and unpredictable in styling overrides.

Screenshots

Using dev
image

Using prod
image

System information

  • OS: MacOS
  • Browser: Chrome
  • Version of Next.js: 9.4.4
  • Version of Node.js: v10.16.0
@sophiekoonin
Copy link

This sounds like it might be related to #12343

@fabinppk
Copy link

This sounds like it might be related to #12343

I think so. 🤔

@Timer Timer added this to the iteration 6 milestone Jul 25, 2020
@Timer Timer modified the milestones: iteration 6, iteration 7 Aug 10, 2020
@Timer Timer self-assigned this Aug 12, 2020
@Timer Timer modified the milestones: iteration 7, backlog Aug 20, 2020
@Timer Timer removed their assignment Aug 20, 2020
@Timer Timer added the good first issue Easy to fix issues, good for newcomers label Aug 20, 2020
@timneutkens timneutkens added the Webpack Related to Webpack with Next.js. label Nov 18, 2021
@balazsorban44 balazsorban44 removed the good first issue Easy to fix issues, good for newcomers label Feb 12, 2022
@samcx samcx added bug Issue was opened via the bug report template. and removed kind: bug labels Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template. Webpack Related to Webpack with Next.js.
Projects
None yet
Development

No branches or pull requests

7 participants