-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
Error: "export 'useId' (imported as 'React') was not found in 'react'" after upgrading to v5.2.0 #29860
Comments
i got exactly the same warning... |
Me too, and also this import:
I'm using with nextjs 12.0.4 |
So, this is pretty hacky, but you should be able to resolve this temporarily/quickly while we're still waiting for this by:
"@mui/icons-material": "5.1.1",
"@mui/material": "5.1.1",
"@mui/utils": "5.1.1",
"@mui/private-theming": "5.1.1",
"@mui/styled-engine": "5.1.1",
"@mui/system": "5.1.1",
"resolutions": {
"@mui/utils": "5.1.1",
"@mui/material": "5.1.1",
} |
@solarmosaic-colin-young That works for me! I noticed it would be solved we pinned the version down to |
The compilation is still successful or does it actually prevent building? |
Any word on the cause? Is 5.2.0 version broken for everyone? I am experiencing this as the only issue migrating an MUI v4 app to v5, however a solution like |
@eps1lon For me it's just a warning. But there's more than the one mentioned here:
|
A warning is certainly annoying though it makes sense that you get one for Trying to understand if we actually get a crash just for Will look at bundlers what the recommended approach is. I don't think they expect that a package should only support a single major version of a peer dependency. |
@sachinahya You have |
Upstream issue: webpack/webpack#14814 Will revert the changes since they're not required for experimenting with React 18. But we need to revisit our React 17/18 compat strategy soon. |
Setting |
Also experiencing this on a new application. Same versions as previous app however (but prev app works fine, weird). Versions
Warnings are..
And they generate a full screen overlay with webpack, which i've had to disable.
|
I would appreciate it, if people would upvote the upstream issue instead. Without a resolution from Webpack you will always get these warnings once React 18 is released and you're still using React 17. I don't think this is a reasonable expectation for libraries imposed by bundlers. We'll revert the responsible changes in the meantime. But once React 18 is released, you'll encounter this issue again. |
Fix
Solves this. Pinning version in Are there any better ideas? |
I had the opposite experience. |
I still got an error ... trying with disable esmodules in babel |
I have this as warning when running nextjs production build. The dynamic style is not applied correctly in the production build but dev build works fine. I'm using latest mui, nextjs, styled-components |
|
A way to bypass the warning is to start webpack with |
Should be fixed in 5.2.1. Make sure you have |
@eps1lon I have updated my package.json file but even then getting the same Warning. "export 'useId' (imported as 'React') was not found in 'react' ". |
@abdul-Tz-prog Did you also run What does |
@eps1lon I have tried npm install and also recreated my package-lock.json file. But getting the same warnings. I did not find any old dependency in the dependency tree. I am unable to install @mui/uitils. It says: "npm ERR! code E404 |
@abdul-Tz-prog Sorry What does |
5.2.1 made my day, solved all those annoying warnings, thanks @eps1lon! |
@mui/material 5.2.1 solved the issue for me. Very prompt resolution! |
./node_modules/@mui/x-data-grid/node_modules/@mui/utils/esm/useId.js
Attempted import error: 'useId' is not exported from 'react' (imported as 'React'). Look like @mui/x-data-grid still have same problem.. I am using the next.js |
Had the same error for my own npm component library created using mui v5. this was the rollup.config.ts before:
following changes in rollup.config.ts solved it: FixNew rollup.config.ts that uses only cjs
Sample repositories: |
This comment was marked as off-topic.
This comment was marked as off-topic.
I know this is closed but thought this might help someone...
|
how to add above those in dependency directly or it require any installation through npm/yarn |
I am facing this issue Attempted import error: 'useSyncExternalStore' is not exported from 'react' (imported as 'React2') in react 16.13. But not able to figureout from where it is getting. |
Current behavior 😯
Building a project on React 17 throws the following errors when running build.
@mui/material: v5.2.0
webpack: 5.64.2
react: 17.0.2
EDIT: Seems to be related to a change in
@mui/utils
where an attempt is made to check for the existence ofuseId
inreact
: 3323b23#diff-41d8fb02706e8d95b775dfa0caadade00dbbcb017d7f2c7acbc3100c5a02d46fExpected behavior 🤔
Build should work on React 17 as v5.2.0 is a minor release and React 18, which includes these imports, is not yet released.
Steps to reproduce 🕹
Steps:
yarn build
.To reproduce working example:
@mui/material
in package.json to~5.1.0
.Context 🔦
No response
Your environment 🌎
`npx @mui/envinfo`
The text was updated successfully, but these errors were encountered: