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

[material-ui] Issues with NextJS 14.1 #40725

Closed
gilthonweapps opened this issue Jan 21, 2024 · 3 comments
Closed

[material-ui] Issues with NextJS 14.1 #40725

gilthonweapps opened this issue Jan 21, 2024 · 3 comments
Assignees
Labels
component: dialog This is the name of the generic UI component, not the React module! external dependency Blocked by external dependency, we can’t do anything about it nextjs

Comments

@gilthonweapps
Copy link

gilthonweapps commented Jan 21, 2024

Steps to reproduce

Link to live example: (CodeSandbox)

Steps:

  1. Create a NextJS project with latest version (14.1) and use App Router
  2. Install latest version of MUI and use AppRouterCacheProvider and CssVarsProvider
  3. Put a <Dialog> component in page.jsx (if you don't put any component, you will have other errors)
  4. Run the project

Current behavior

Issues in the console:

Attempted import error: 'useLayoutEffect' is not exported from 'react' (imported as 'useLayoutEffect').

Import trace for requested module:
./node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs
./node_modules/@mui/base/Unstable_Popup/Popup.js
./node_modules/@mui/base/Unstable_Popup/index.js
./node_modules/@mui/base/index.js
./node_modules/@mui/material/Modal/Modal.js
./node_modules/@mui/material/Modal/index.js
./node_modules/@mui/material/Dialog/Dialog.js
./node_modules/@mui/material/Dialog/index.js
__barrel_optimize__?names=Dialog!=!./node_modules/@mui/material/index.js

Expected behavior

Should run without issue

Context

No response

Your environment

npx @mui/envinfo
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.

Search keywords: nextjs app router

@gilthonweapps gilthonweapps added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jan 21, 2024
@zannager zannager added component: dialog This is the name of the generic UI component, not the React module! nextjs labels Jan 22, 2024
@samuelsycamore
Copy link
Member

samuelsycamore commented Feb 5, 2024

It appears that Floating UI (used internally by the Base UI Popup component) is the source of this error:

./node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs

cc: @michaldudak

@samuelsycamore samuelsycamore added status: expected behavior Does not imply the behavior is intended. Just that we know about it and can't work around it and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer status: expected behavior Does not imply the behavior is intended. Just that we know about it and can't work around it labels Feb 5, 2024
@michaldudak
Copy link
Member

Looks like something is messed up with ESM/CJS imports. I'm not sure on which side, though.

@jrjake
Copy link

jrjake commented Feb 12, 2024

Appears to be a bug in Next.js, which has apparently been fixed in their 14.1.1 canary vercel/next.js#61185

@siriwatknp siriwatknp added the external dependency Blocked by external dependency, we can’t do anything about it label Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: dialog This is the name of the generic UI component, not the React module! external dependency Blocked by external dependency, we can’t do anything about it nextjs
Projects
None yet
Development

No branches or pull requests

6 participants