Emotion custom style insertion point is not applied when using material-ui from CDN link
See original GitHub issueI have a container page that links to material-ui CDN as well as react and react-dom, and a webcomponent with a shadow-dom, then I set the emotion style insertion point to inside this shadow-dom. The styles are applied only if I use material-ui as a npm dependency.
- The issue is present in the latest release.
- I have searched the issues of this repository and believe that this is not a duplicate.
Current Behavior 😯
The emotion styles are not applied inside the shadow dom: https://codesandbox.io/s/emotion-material-ui-cdn-issue-4cr5g when using material-ui via CDN.
Expected Behavior 🤔
To have emotions styles applied as I have here: https://codesandbox.io/s/emotion-material-ui-without-cdn-idlyp (when not using material-ui from the CDN link)
Steps to Reproduce 🕹
Ps. I haven’t used the official codesandbox because I wanted to configure webpack in the create-react-app
Steps:
- Go to this codesandbox and check (browser inspector) that emotion styles are applied in the
head
tag. (In this container material is linked via cdn aliased using craco) - Compare the result with this codesandbox using material-ui as a NPM dependency, emotion styles are correctly applied inside the shadow-dom
Context 🔦
Though in material-ui documentation the CDN usage is not recommended, I’m defining a microfrontend via runtime integration with web-component architecture, and I don’t want to ship material-ui inside all web-components, but instead have it defined in the container page with the web-components referencing it.
Ps. The material-ui CDN will likely to be incorporated in my company infrastructure and likely be removed the components that we do not use.
Your Environment 🌎
- create-react-app
- craco
- yarn
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (5 by maintainers)
@mnajdova would you mind taking a look at it?
@vanderleisilva In the code sandbox you linked (link), the MUI styles are not being applied correctly. You can see that a default button is shown instead of a MUI one. Is this supposed to happen? I’m trying this same approach and am not able to get it working either.