-
-
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
@material-ui/core has no exported member 'MuiThemeProvider' #16489
Comments
It's exported in |
It is exported indeed. When you log MuiThemeProvider function ThemeProvider(props) {
var children = props.children,
localTheme = props.theme;
var outerTheme = Object(_useTheme__WEBPACK_IMPORTED_MODULE_6__["default"])();
true ? warning__WEBPACK_IMPORTED_MODULE_3___default()(outerTheme !== null || typeof localTheme !== 'function', ['Material-UI: you are providing a theme function property ' + 'to the ThemeProvider component:', '<ThemeProvider theme={outerTheme => outerTheme} />', '', 'However, no outer theme is present.', 'Make sure a theme is already injected higher in the React tree ' + 'or provide a theme object.'].join('\n')) : undefined;
var theme = react__WEBPACK_IMPORTED_MODULE_1___default.a.useMemo(function () {
var output = outerTheme === null ? localTheme : mergeOuterLocalTheme(outerTheme, localTheme);
if (outerTheme !== null && output) {
output[_nested__WEBPACK_IMPORTED_MODULE_7__["default"]] = true;
}
return output;
}, [localTheme, outerTheme]);
return react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_useTheme_ThemeContext__WEBPACK_IMPORTED_MODULE_5__["default"].Provider, {
value: theme
}, children);
} However the |
https://github.com/mui-org/material-ui/blob/6a7daaad5d7db4ebcc48eeeba927ef007c655e5f/packages/material-ui/src/styles/index.js#L5 It is exported |
A temporary workaround is to add the // @ts-ignore
import { colors, createMuiTheme, MuiThemeProvider } from '@material-ui/core'; |
Or an even better solution as suggested by @merceyz would be to import import { MuiThemeProvider } from '@material-ui/core/styles' |
Do we need to use both |
Module not found: Error: Can't resolve '@material-ui/core/styles' |
Expected Behavior 🤔
MuiThemeProvider
is exported by@matterial-ui/core
or a related packageCurrent Behavior 😯
Error is thrown
@material-ui/core has no exported member 'MuiThemeProvider'
Steps to Reproduce 🕹
Link:
Context 🔦
MuiThemeProvider was present in version 3 and there is no mention of it having been moved to another place.
Searched here https://material-ui.com/guides/migration-v3/#theme and #13663
Switching palette from dark to light and vice versa does not work without it, among other things.
Your Environment 🌎
The text was updated successfully, but these errors were encountered: