Styles not added on client side in production mode
See original GitHub issueSo, whenever I am running my app in development mode, everything is fine, but the moment I switch to production, the styles are sent from the server, but when the styles are removed on the client side, they don’t appear to be added back in. Although the new classes are added to the head
section, the classnames are not updated on the actual DOM, which means the styles are not applied. Everything else works, but the styles just are not updated for some reason. I followed the instructions on https://material-ui.com/guides/server-rendering/ exactly, and everything works fine unless I change the mode to production.
- This is a v1.x issue.
- [* ] I have searched the issues of this repository and believe that this is not a duplicate.
Expected Behavior
Styles display correctly
Current Behavior
Styles display incorrectly
Steps to Reproduce
clone https://gitlab.com/zwhitchcox/aworth
git pull mui-bug && git checkout mui-bug
(I think, just the branch is mui-bug)
run make dev-build && make dev-up
(must have docker installed)
Context
I’m trying to make it so styles show up properly in my app
Your Environment
Tech | Version |
---|
"@material-ui/core": "^1.4.0",
"@material-ui/icons": "^1.1.0",
"react": "^16.4.1",
"react-dom": "^16.4.1",
browser: chrome
Issue Analytics
- State:
- Created 5 years ago
- Comments:17
Top GitHub Comments
👋 Thanks for using Material-UI!
We use the issue tracker exclusively for bug reports and feature requests, however, this issue appears to be a support request or question. Please ask on StackOverflow where the community will do their best to help. There is a “material-ui” tag that you can use to tag your question.
If you would like to link from here to your question on SO, it will help others find it. If your issues is confirmed as a bug, you are welcome to reopen the issue using the issue template.
@morgoe 9 months late, but for future we were able to get it working using the cross-env package in our package.json: “prodBuild”: “cross-env NODE_ENV=production nx run example-app:build:production”, “prodServe”: “cross-env NODE_ENV=production nx run example-app:serve:production”
Should work with the next build too I think. We just ran into the issue with nx specifically.