-
-
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
Optimize bundle size (now 317KB with v4) #24381
Comments
@masbaehr You can track the bundle size of v5 using https://bundlephobia.com/result?p=@material-ui/core@next. We have made significant progress in v5 compared to v4: We still have a few opportunities to improve bundle size with better tree-shaking between components:
|
In a single page - this is true. But isn't everything still packed into one *.chunk.js file? That is at least the case if you're not using code-splitting. I already do this for heavy stuff like recharts, but material-ui being something which is needed almost everywhere I find it rather hard to do this. Throughout all the pages, I use most of the components somewhere. While 381k 111k gzipped is not much per se, the thing is, it adds up rather quickly. |
With what does it add up though? Most of the components implement base UI patterns on the web. We don't recommend that you import 3 different Autocomplete implementations in your page. So it shouldn't ever add up in your bundle.
What makes this easier to do with recharts but not Material-UI? Again, are you importing all of material-ui everywhere? It would be more helpful to share the bundle you're currently shipping. That helps us finding duplicates we can potentially eliminate. For example, maybe most of our users need a different popper library in which case we should use that instead of |
From the the bundle screenshot you posted it looks like you do import all of Material-UI. Other notes: |
Something in your app is responsible for importing all of Material-UI it seems. |
material-table-core/core#45 Maybe it's material-table triggering it |
Hi, this is not an issue but i'd like to know if there is some room to improve the bundle size, or if there is something i can do as a user to reduce the size. currently it is like this:
https://bundlephobia.com/result?p=@material-ui/core@4.11.2
There seem to be some components which are rather big in comparision for example TablePagination SwipeableDrawer TabScrollButton
I was unable to check for the v5 though yet. Will it improve?
The text was updated successfully, but these errors were encountered: