Dany Dhondt
Dany Dhondt

Reputation: 891

Material-ui layout scrambled after production build

I have build a website based on node.js, material-ui and create-react-app.

When I do a development build using yarn start I get this result on localhost:

Localhost display

Then, after doing a production build using yarn build, I get this:

enter image description here

All the functionality works except for the layout.

Any ideas what might be the cause?

Upvotes: 4

Views: 1602

Answers (1)

Evgeny Timoshenko
Evgeny Timoshenko

Reputation: 3259

It looks like material-ui is included two extra times by rollup, which breaks the app. If you take a closer look at what is built in med-react-component and bo-module-taxonomie you will notice that rollup includes material-ui in both builds. Since you are using rollup-plugin-peer-deps-external, you should make material-ui peer dependency in both med-react-component and bo-module-taxonomie:

"peerDependencies": {
    "@material-ui/core": "^1.0.0",
    "@material-ui/icons": "^1.0.0",
    ...

Upvotes: 5

Related Questions