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

Error when building 5.3.0 with React 17 ('useId' is not exported from 'react') #138

Closed
ryanadhi opened this issue Sep 2, 2024 · 7 comments
Labels

Comments

@ryanadhi
Copy link

ryanadhi commented Sep 2, 2024

"material-ui-popup-state": "^5.3.0"
"react": "17.0.2"

code

 <PopupState variant="popover" popupId="demoMenu">
            {popupState => (
                <ClickAwayListener onClickAway={(event) => popupState.close(event as any)}>
                  ...
                </ClickAwayListener>
            )}
</PopupState>

error

Failed to compile.

./node_modules/material-ui-popup-state/hooks.mjs
Attempted import error: 'useId' is not exported from 'react' (imported as 'React').
@jedwards1211
Copy link
Member

That's unfortunate, I had tried to make it only use useId if it's available...what bundler are you using?

@ryanadhi
Copy link
Author

ryanadhi commented Sep 2, 2024

@jedwards1211 I am using Next 12.1.0, so I just use next build && next export. I believe it is using using Webpack

@jedwards1211
Copy link
Member

Okay thanks, I'll figure it out

@jedwards1211
Copy link
Member

🎉 This issue has been resolved in version 5.3.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@jedwards1211
Copy link
Member

jedwards1211 commented Sep 2, 2024

Okay this change fixed the issue in a Next 12.3.4 project for me (was having other problems figuring out how to downgrade the created project all the way to 12.1.0) but let me know if it fixes the issue for you

Edit: I downgraded to Next 12.1.0 and commented out some CSS imports, and I was able to get the build to pass

@ryanadhi
Copy link
Author

ryanadhi commented Sep 3, 2024

@jedwards1211 yes I am able to build with 5.3.1. Thanks!

@jedwards1211
Copy link
Member

Great, yw!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants