I removed my node_modules folder and did a fresh install of the @material-ui/core. Realized that it missed the files MuiThemeProvider.js and MuiThemeProvider.d.ts
I am having compilation problems as this is missing MuiThemeProvider.
npm install @material-ui/core
run the above command and it installed the version 4.5.1 but it missed the files required for MuiThemeProvider and so my code is having compile problems
| Tech | Version |
| ----------- | ------- |
| Material-UI | v4.5.1 |
| React | 16.8.6 |
| Browser | |
| TypeScript | |
| etc. | |
Can you give an example of how you import the MuiThemeProvider
?
import MuiThemeProvider from '@material-ui/core/styles/MuiThemeProvider'
And also this just did not happen for me alone. The other developers within the team also faced the problem.
@material-ui/core/styles/MuiThemeProvider
is a private file path, import it from:
import { MuiThemeProvider } from '@material-ui/core/styles';
or
import { MuiThemeProvider } from '@material-ui/core';
Thank you.
We might want to introduce MuiThemeProvider back with a warning, it would be less disruptive even if people should never import more than 2 levels deep:
Also, as MuiThemeProvider is no longer documented since v4.0.0, we might as well encourage ThemeProvider
instead.
Hi guys,
I'm currently running "@material-ui/core": "^4.9.5"
Receiving the error about:
_Material-UI: you have imported a private module.
Please replace the '@material-ui/core/styles/MuiThemeProvider' import with:
import { ThemeProvider as MuiThemeProvider } from '@material-ui/core/styles';
Yet when I do that, now I receive the error
Uncaught Error: Cannot find module '@material-ui/core/styles/ThemeProvider'
at webpackMissingModule (index.tsx:2)
at eval (index.tsx:2)and
./app/index.tsx
Module not found: Error: Can't resolve '@material-ui/core/styles/ThemeProvider'
What's going on?
Update 10/3/2020: If anyone else has this problem, turns out awesome-typescript-loader was to blame. Switching back to standard ts-loader fixed thie issue
Most helpful comment
@material-ui/core/styles/MuiThemeProvider
is a private file path, import it from:or