-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
CacheProvider ignored in UMD build #40494
Comments
I guess this is specific to emotion? |
Dont know since it works when i bundle MUI inside. So emotion seems to work. You can try it out when you remove mui from the peerDeps and build again. Then all works since vite is not bundeling mui as external. Because auf this I assumed it could be a problem with the UMD build but i am not 100% sure and also not sure how I could boil it down more to identify the source of the issue. |
I posted it to emotion as well: emotion-js/emotion#3147 |
I found a related issue: #29568 |
This looks normal, the UMD is meant to play with the API, it bundles everything so the Emotion React cache is duplicated, so the context value doesn't propagate. I'm closing, see #40960, we are removing the UMD bundle. |
Ok for everyone who finds this and want to find a solution. I found something that worked: I bundle my resources now on my own and push them to s3. For that you can use rollup with something like:
After that I load them in the head in the right order. Keep in mind that this is just prototype code and I still need to prove it in prod. |
Steps to reproduce
Link to live example: https://github.com/beuluis/MUI-Shadow-DOM-CacheProvider-Broken-Theme
Steps:
npm start
it is important to actually build it otherwise vite runs in dev mode and all works fineCurrent behavior
MUI does not use the provided
shadowContainer
to mount styles into.Expected behavior
MUI should mount styles in the specified
shadowContainer
inside the shadow DOM context.Context
I am trying to archive a reusable web-component build (Web-components was excluded from the example to boil it down) with external resources to contra balance the payload size.
Maybe helpful:
When removing
@mui/material
from the externals and bundle it within, everything works as aspected. This leads me to believe that the UMD build may be broken.Your environment
npx @mui/envinfo
Used UMD builds
Search keywords: umd emotion CacheProvider
The text was updated successfully, but these errors were encountered: