question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[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:

  1. Update to latest MUI alpha and install @material-ui/styled-engine-sc according to readme.
  2. Add webpack alias for styled-engine
  3. 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:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
oliviertassinaricommented, Oct 16, 2020

@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

Capture d’écran 2020-10-17 à 01 07 51

Thanks for the reproduction!

0reactions
mnajdovacommented, Oct 16, 2020

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 @oliviertassinari

Edited create-react-app example project works correct, as we have the new version for the @material-ui/styled-engine package

Read more comments on GitHub >

github_iconTop Results From Across the Web

[v5.0.0-alpha.12] ThemeContext not found when using styled ...
The build finishes with a warning which states export 'ThemeContext' (imported as 'StyledEngineThemeContext') was not found in '@material-ui/ ...
Read more >
Material-UI v5 not working styled-components and typescript?
I'm trying to use the mui-v5 with styled-components and typescript. However, even after I added the line to my tsconfig:
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found