[v5.0.0-alpha.12] ThemeContext not found when using styled-engine-sc
See original GitHub issue- [x ] The issue is present in the latest release.
- [x ] I have searched the issues of this repository and believe that this is not a duplicate.
Current Behavior 😯
Because I already use styled-components, I installed @material-ui/styled-engine-sc and added an alias in my webpack config. The build finishes with a warning which states export 'ThemeContext' (imported as 'StyledEngineThemeContext') was not found in '@material-ui/styled-engine'
and my app returns a blank page with the error Uncaught TypeError: Cannot read property 'Provider' of undefined
.
Expected Behavior 🤔
The build should finish without any warnings and the app should work as usual.
Steps to Reproduce 🕹
Steps:
- Update to latest MUI alpha and install @material-ui/styled-engine-sc according to readme.
- Add webpack alias for styled-engine
- Run webpack build
Additional information
Is there a possible problem with my config or is there something missing in the styled-engine-sc package? Because as soon as I add
export { ThemeContext } from 'styled-components';
to the index.js file in styled-engine-sc/esm/index.js
the build finishes without error and my app works as expected.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top GitHub Comments
@material-ui/styled-engine-sc@5.0.0-alpha.12
released. Sorry, I have missed it the change.It works now https://codesandbox.io/s/interesting-kalam-fij5k?file=/src/App.tsx
Thanks for the reproduction!
I was able to repro it on our
create-react-app-with-styled-components
. Seems like we didn’t release the new version for the@material-ui/styled-engine-sc
package. FYI @oliviertassinariEdited
create-react-app
example project works correct, as we have the new version for the@material-ui/styled-engine
package