-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
Material UI v6 + Remix + Vite running with “Prop className
did not match” error
#43980
Comments
Same here. My workaround (only works for v6.1.2, not for v6.1.1) is to update ssr: {
noExternal: [process.env.NODE_ENV === 'development' ? '@mui/icons-material' : /^@mui\//],
}, In my case, |
Hey @onozaty, thanks for the report, and sorry for the late reply. I'm unable to run your repro. May I ask you to provide further details (maybe a video) on how to run it? I'm stuck so far as I'm unclear where I should run Thanks @s-hashimo for chiming in, about your investigation:
could you provide a minimal repro of the behavior you're experiencing? This would help debug whatever is happening. |
Thanks for replying. 😃 Here is my minimal? repro: https://github.com/s-hashimo/remix-vite-mui And here are the commands to reproduce: npm i
npm run dev
It's based on the following two packages:
I suppose that the |
Hey @onozaty, thanks for the repro. I spent some time debugging this, but unfortunately, I still haven't figured out what's happening. I checked that the className mismatch warning also happens when using We've had similar issues with next: #29428 I'm not seeing this error in our Remix example: https://github.com/mui/material-ui/tree/master/examples/material-ui-remix-ts, so if it's a possibility for you to start using that, then it might help. It might also help to compare with your current setup. If you confirm that this is also happening in v5, I think we can accept the issue as a remix integration improvement. |
Thank you for working on this issue.
This did not occur in v5.16.7.
This example provided by MUI does not use Vite. The templates provided by Remix use Vite, and it is common practice to use Vite. Thanks. |
I get the
|
I'm out for two more weeks, but in the meantime, if anyone feels like trying out the same as #44055 (comment). I suspect the same root cause. |
Hmm I tried this and the errors changed a little: - "@mui/icons-material": "6.1.7",
- "@mui/material": "6.1.7",
- "@mui/system": "6.1.7",
+ "@mui/icons-material": "https://pkg.csb.dev/mui/material-ui/commit/32a26054/@mui/icons-material",
+ "@mui/material": "https://pkg.csb.dev/mui/material-ui/commit/32a26054/@mui/material",
+ "@mui/system": "https://pkg.csb.dev/mui/material-ui/commit/32a26054/@mui/system", Node 20:
Node 22:
|
Hey everyone, looked into this one again. I tested with the builds from #43264 and got the same errors @samausir encountered (shown above). What I found is that the |
👍 yes, full esm support for node.js is planned for v7. |
To clarify, does this mean it won't be usable until v7, or is there an earlier patch coming? |
@mikezx6r may I ask you which package manager are you using? @Janpot can you think of a way to workaround this in the meantime? I tried patching, but couldn't get it working with npm (and couldn't repro with yarn or pnpm) In the meantime, if anyone wants to give it a try, I think following a similar approach as this comment might work, let us know. |
I am using npm. Will take a look at link to see if it helps
|
@DiegoAndai I've read the comment, but it claims that icons-material has already been fixed. In my case, that's the ONLY package that is giving me issues. Here's a link to a small project that demonstrates the issue. Let me know if there's anything else I can do for this, or if I didn't understand the suggestions in the comment correctly |
I haven't tested this, but since you're already patching, you could try to patch the icons package and remove its exports field in the package.json. Then add this alias to your vite config. I'm sorry, I'll still be out a bit longer (paternity leave). Should be back by January. |
If the icons package is the only one giving issues, have you tried pinning it to a previous version? That might work, and you can unpin it once v7 is released. This package won't receive significant updates in v6, so I don't expect you missing anything if you pin it to a previous version that works. Let me know. |
@DiegoAndai pinning icons-material to v5 solved my problem 👍 |
I'm glad to hear that @samausir. I think you should also be able to use |
Can confirm v6.0.2 works too 👍 |
Steps to reproduce
Execute the following repository,
Steps:
npm run dev
Current behavior
The following will appear in your browser's console
Expected behavior
Expect no errors in the browser console.
Context
This did not occur with Material UI v5.
The code for v5 is as follows.
When I upgraded from Material UI v5 to v6, I initially got the following error with
npm run dev
.To avoid this, the following settings are added in
vite.config.ts
.Now the screen itself can be displayed, but there is an error in the browser console.
Your environment
npx @mui/envinfo
Search keywords: Remix Vite
The text was updated successfully, but these errors were encountered: