mui / material-ui

Material UI: Comprehensive React component library that implements Google's Material Design. Free forever.
https://mui.com/material-ui/
MIT License
94.02k stars 32.3k forks source link

[material-ui] How to optimize the installed Material UI package? #42027

Open swatinawale27 opened 6 months ago

swatinawale27 commented 6 months ago

Steps to reproduce

Link to live example: (required)

Steps: 1. 2. 3.

Current behavior

No response

Expected behavior

No response

Context

We have react js application integrated with MUI. When application is deployed production on Kubernetes, we observed size of MUI packages taking more than 350mb space. packages taking extra space are @mui, @mui/icons-material version used :5

Can you please suggest how to reduce bundle size of MUI packages, i referred below link but didn't get much help. Top level imports are used in application e.g. "import { Button, TextField } from '@mui/material';"

https://mui.com/material-ui/guides/minimizing-bundle-size/

Your environment

No response

Search keywords: memory

oliviertassinari commented 6 months ago

350mb space. packages taking extra space are https://github.com/mui, @mui/icons-material

Are you talking about disk space?

Can you please suggest how to reduce bundle size of MUI packages, i referred below link but didn't get much help. Top level imports are used in application e.g. "import { Button, TextField } from '@mui/material';" https://mui.com/material-ui/guides/minimizing-bundle-size/

Or are you talking about bundle size?

Memory utilization

Or are you talking about RAM usage?


My best guess is that "350mb space" means 350 KB gzipped. I doubt there is much to do about this that is Material UI specific. The usual tree shaking and code-splitting best practices should solve the problem.

swatinawale27 commented 6 months ago

When we install node_module docker image for the react js application on Kubernetes, @mui takes 170340 kb and @mui/icons-material takes 132948 kb disk space.

swatinawale27 commented 6 months ago

Any solution to mentioned issue?