-
Notifications
You must be signed in to change notification settings - Fork 26.1k
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
v14.2 causing build error for Material UI #64369
Comments
This is getting ridiculous. Every second Next.js update breaks compatibility with MUI. It was the same a couple versions ago. Do you guys really have no tests for that scenario - building a basic MUI app? |
My app compiles, but pages crash with:
To repro have a import { Typography } from "@mui/material";
export function Page() {
return <Typography>hello world</Typography>;
} |
I got the same build error too with MUI 5.15.15. I tested the canary versions since 14.1.0, and found that the last-known working canary is 14.1.1-canary.62. Starting from 14.1.1-canary.63, the build fails consistently with this prerender error all the way to 14.2.0.
There must be something in between v14.1.1-canary.62...v14.1.1-canary.63 that breaks the build. |
I can also verify the same build error with MUI
|
I got the same error with @mui/icons-material: 5.15.14 and next: 14.2.0 Simple example of Next.Js page
After |
Same for me after upgrading to 14.2.0 builds started failing for pages where we use |
Experiencing the same issue after upgrading to v14.2. Also, not able to reproduce this issue in my local (run with |
Downgrading mui to 5.15.6 works for me with the reproduction (next 14.2), it starts breaking since 5.15.7 with next 14.2 |
I'm receiving this same error intermittently in prod after upgrading to 14.2.0. I can't say for sure it's from MUI but I am using MUI 5.15.3. Some symptoms different: builds fine, most things work fine, but some navigations between pages (esp if I load a particular page and click a particular Link on page) triggers it a good 90% of the time. |
Preparing a fix in #64467 |
### What Inherit the client boudaries from the found matched target in load barrel ### Why The root cause with the barrel transform, we missed the client boundary directive during the transform. Since the new version of mui's case looks like this: Import path page.js (server module) -> `<module>/index.js` (shared module) -> `<module/subpath>/index.js` (client module) -> `<module/subpath/sub-module.js> (client module) After our transform, we lost the `"use client"` which causes the mismatch of the transform: In `rsc` layer: the file pointing to the sub module entry (`<module/subpath>/index.js`), but without the client boundary. Fixes #64369 Closes NEXT-3101
@Jordaneisenburger same here, even after the #64467 fix, I've opened a new issue about it: #64518 |
### What Inherit the client boudaries from the found matched target in load barrel ### Why The root cause with the barrel transform, we missed the client boundary directive during the transform. Since the new version of mui's case looks like this: Import path page.js (server module) -> `<module>/index.js` (shared module) -> `<module/subpath>/index.js` (client module) -> `<module/subpath/sub-module.js> (client module) After our transform, we lost the `"use client"` which causes the mismatch of the transform: In `rsc` layer: the file pointing to the sub module entry (`<module/subpath>/index.js`), but without the client boundary. Fixes #64369 Closes NEXT-3101
@nunesunil Please check the update in #64518 (comment) |
The fix is published in 14.2.3, please upgrade to the new version 🙏 |
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Link to the code that reproduces this issue
https://github.com/nunesunil/next-js
To Reproduce
Start the appliction for creating build(npm run build), then the build fails with the following error -
sunil@Sunils-MBP-M2 my-app % npm run build
▲ Next.js 14.2.0
Creating an optimized production build ...
✓ Compiled successfully
✓ Linting and checking validity of types
✓ Collecting page data
Generating static pages (0/5) [ ]Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
at nM (/Users/sunil/Desktop/my-app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:61599)
at nM (/Users/sunil/Desktop/my-app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:61546)
at nN (/Users/sunil/Desktop/my-app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:64546)
at nB (/Users/sunil/Desktop/my-app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:67538)
at nM (/Users/sunil/Desktop/my-app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:58560)
at nN (/Users/sunil/Desktop/my-app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:64546)
at nB (/Users/sunil/Desktop/my-app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:67538)
at nD (/Users/sunil/Desktop/my-app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:66680)
at nN (/Users/sunil/Desktop/my-app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:64853)
at nB (/Users/sunil/Desktop/my-app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:67538) {
digest: '4272938947'
}
Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error
Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
at nM (/Users/sunil/Desktop/my-app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:61599)
at nM (/Users/sunil/Desktop/my-app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:61546)
at nN (/Users/sunil/Desktop/my-app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:64546)
at nB (/Users/sunil/Desktop/my-app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:67538)
at nM (/Users/sunil/Desktop/my-app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:58560)
at nN (/Users/sunil/Desktop/my-app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:64546)
at nB (/Users/sunil/Desktop/my-app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:67538)
at nD (/Users/sunil/Desktop/my-app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:66680)
at nN (/Users/sunil/Desktop/my-app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:64853)
at nB (/Users/sunil/Desktop/my-app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:67538)
✓ Generating static pages (5/5)
Current vs. Expected behavior
The build is expected to create a static pages.
Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 23.4.0: Fri Mar 15 00:12:49 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6020 Available memory (MB): 32768 Available CPU cores: 10 Binaries: Node: 20.12.2 npm: 10.5.2 Yarn: N/A pnpm: N/A Relevant Packages: next: 14.2.0 // Latest available version is detected (14.2.0). eslint-config-next: N/A react: 18.2.0 react-dom: 18.2.0 typescript: 5.4.5 Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
Not sure, App Router
Which stage(s) are affected? (Select all that apply)
next build (local), Vercel (Deployed)
Additional context
If I use h1 Tag instead of MUI Typography in page build is success.
NEXT-3101
The text was updated successfully, but these errors were encountered: