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

Production Build Styling incorrect when using MUI Components in layout.tsx on Next.js #386

Open
Adralonter opened this issue Feb 27, 2025 · 0 comments
Assignees
Labels
nextjs package: system Specific to @mui/system status: waiting for maintainer These issues haven't been looked at yet by a maintainer

Comments

@Adralonter
Copy link

Adralonter commented Feb 27, 2025

Steps to reproduce

  1. Open this CodeSandbox
  2. Start the Dev Server
  3. Build the Project
  4. Start Server
  5. Open both in preview and see differences

Current behavior

I ran into an issue using Next.js, MUI and pigment-css, where the styles on the production build are incorrect. The cause seems to be using MUI Components directly in the layout.tsx file. It results in MUI Components (both in the layout and the page) to get displayed incorrectly. A workaround would be to use the Header at the top of the page.tsx instead.

On the left is the Dev Server, on the right is the Server with the Build.
Image

Expected behavior

It should be possible to use MUI Components directly in the layout file.

Context

No response

Your environment

npmPackages: @mui/material: ^6.3.1 => 6.3.1 @mui/material-pigment-css: ^6.3.1 => 6.3.1 @pigment-css/nextjs-plugin: ^0.0.29 => 0.0.29 @pigment-css/react: ^0.0.29 => 0.0.29 @types/react: ^19.0.4 => 19.0.4 react: ^19.0.0 => 19.0.0 react-dom: ^19.0.0 => 19.0.0 typescript: ^5.7.3 => 5.7.3

Search keywords: Next.js Build MUI

@Adralonter Adralonter added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Feb 27, 2025
@zannager zannager added package: system Specific to @mui/system nextjs labels Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
nextjs package: system Specific to @mui/system status: waiting for maintainer These issues haven't been looked at yet by a maintainer
Projects
None yet
Development

No branches or pull requests

3 participants