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 in production when building with vite 2.7+ #88

Closed
faradaytrs opened this issue Dec 28, 2021 · 4 comments
Closed

Error in production when building with vite 2.7+ #88

faradaytrs opened this issue Dec 28, 2021 · 4 comments
Labels

Comments

@faradaytrs
Copy link

faradaytrs commented Dec 28, 2021

It was fine until i updated vite to 2.7. It uses rollup internally.
When i remove all uses of this library problem also disappears.
Error is:
TypeError: gM is not a function
at vM (core.js:28)
at core.js:24

I tried to disable minification and it produces something like: interopRequireWildcard error
Name depends on build due to minification, but error is the same every time. Any ideas why could cause the issue?

Now i'm using:
react 17.0.2
Vite 2.7.6
material-ui-popup-state: 2.0.0

@dixso
Copy link

dixso commented Dec 28, 2021

Hi,
I had the same problem, I fixed using the ES compilation:

Instead of import this:
import { PopupState } from 'material-ui-popup-state/core';

Try this:
import { PopupState } from 'material-ui-popup-state/es/core';

Regards

@jedwards1211
Copy link
Member

Thank goodness I have the ES build in place, it's not very well documented in any of my packages...definitely make sure to use only one or the other.

Before long I'll have to devote more attention to the whole ESM/CJS mess...

@dantman
Copy link

dantman commented Jan 26, 2022

Releasing a new major that uses package.json:exports would probably be warranted. That'll take care of making sure that Vite/WebPack5/etc all use the ESM version.

jedwards1211 added a commit that referenced this issue May 11, 2022
fix #88

BREAKING CHANGE: package.json now uses conditional exports, so `/es/` imports are gone.
Now you can `import { ... } from 'material-ui-popup-state/hooks'` instead of `'material-ui-popup-state/es/hooks'`.
@jedwards1211
Copy link
Member

🎉 This issue has been resolved in version 3.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

4 participants