-
-
Notifications
You must be signed in to change notification settings - Fork 111
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
When using React Material-UI and Emotion in a Mono-Repo (PNPM) Emotion is included two times #33
Comments
When adding a debug
|
The issue seems to be related to dev-mode only. In the production build + |
same issue for me |
This bug still happen with the latest version of Vite. @patak-dev I think this bug should go back to Vite core repo, it seems to be an issue with how pre-bundling works. Another workaround I found is to make the main app explicitly depend on |
Hi! Bumping all dependencies to latest and restating the lockfile from scratch solve the issue. The bug is really sensitive to the fact that you can have a mismatch of emotion versions between the uikit and your app. Maybe having only one version in the workspace could make this more stable. If you still find yourself having issues with this, I suggest you open create a new issue into the core repo |
Describe the bug
In my set-up two variants of the same
@emotion/react
(identical version, different module format) library are sent over to the browser.I created a small showcase for the issue here: https://github.com/swernerx/emotion-react-vite-issue
Seems to be related to the situation that Emotion is being used as a direct and indirect dependency inside a (pnpm-powered) mono-repository set-up. In the case of
@emotion/react
either both the CJS and the ESM version or two ESM bundles are sent to the browser. The library contains a check to warn about a duplicate import situation, which made us aware of the problem. There might be other libraries/use-cases where the same issue applies.Reproduction
https://github.com/swernerx/emotion-react-vite-issue
System Info
Used Package Manager
pnpm
Logs
Validations
The text was updated successfully, but these errors were encountered: