[material-ui-icons] load-order problem with SSR and ES6 use of material-ui; needs ES variant?
See original GitHub issuematerial-ui-icons uses material-ui/SvgIcon
, which uses material-ui/styles/withStyles
, which creates a static generateClassNames, resetting the static rule counter.
In an app that is otherwise using ES6 material-ui, including material-ui/**es**/styles/withStyles
, this results in the counter being reset. If that happens before any JssProvider is set up, all good. But if it happens afterward, as is likely with chunked production client code, it resets the rule counter late, resulting in className skewage in hydration of the SSR rendering.
A workaround in client code is to force early loading of material-ui/styles/withStyles
in the browser, e.g., in TypeScript:
import {default as wrongWithStyles} from 'material-ui/styles/withStyles'
const _fooWrongStyles = wrongWithStyles
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:14 (10 by maintainers)
Top Results From Across the Web
[material-ui-icons] load-order problem with SSR and ES6 use ...
In an app that is otherwise using ES6 material-ui, including material-ui/**es**/styles/withStyles , this results in the counter being reset.
Read more >Material Icons - Material UI - MUI
The @mui/icons-material package depends on @mui/material , which requires Emotion packages. If you don't use Material UI in your project yet, install the...
Read more >@material-ui/icons | Yarn - Package Manager
@material-ui/icons. This package provides the Google Material icons packaged as a set of React components. Installation. Install the package in your project ...
Read more >How can I import Material UI icons?i met some problems using ...
Material UI doesn't provide icons from "@material-ui/icons" any more. Instead, you need to import icons from "@mui/icons-material".
Read more >CHANGELOG.md - TINMAN
chainPropTypes issue ### `@material-ui/styles@v3.0.0-alpha.6` - Fix utils. ... clarity around the usage of font icons (#13628) @JosephMart - [docs] Add ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Here’s the code for
lodash-es
and@material-ui/es
.It already works with lodash-es, so IMHO an
@material-ui/icons-es
would probably work out fairly well.I don’t think
@material-ui/icons/es
and@material-ui/icons-es
are any different in that regard. I use the MUIes/
folder fine even with 3rd party libraries using a WebPack config to make everything usees/
.