Skip to content
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

Bundle size appears too big #11830

Closed
deepfriedbrain opened this issue Jun 12, 2018 · 3 comments · May be fixed by nbv1982/material-ui#10 or hzhz/material-ui#96
Closed

Bundle size appears too big #11830

deepfriedbrain opened this issue Jun 12, 2018 · 3 comments · May be fixed by nbv1982/material-ui#10 or hzhz/material-ui#96
Labels
support: question Community support but can be turned into an improvement

Comments

@deepfriedbrain
Copy link

I'm using MUI v0.17.4. I know 0.x is not supported and I'm already planning to upgrade to 1.x. I'm trying to check whether upgrading would help me cut down the bundle size significantly, and see if I'm making any obvious mistakes at the moment with 0.x.

While analyzing the production bundle I noticed a few things:

  1. The bundle size of 260KB appears to be rather big. If I switch to v1.x, how much reduction in bundle size can I expect to get with the same set of components?
  2. While I'm importing about 10-15 colors in my project, every single color in the colors.js is part of my bundle. Is this normal or am I making some mistake? I'm importing the colors like so:
    import {amber600, blue600} from 'material-ui/styles/colors'
  3. I noticed that some components are included in the bundle which I'm not directly importing, for example FontIcon, EnhancedSwitch. What is importing these components?

image

Thanks so much!

@oliviertassinari oliviertassinari added the support: question Community support but can be turned into an improvement label Jun 12, 2018
@oliviertassinari
Copy link
Member

oliviertassinari commented Jun 12, 2018

The bundle size of 260KB

It's 54kB gzipped. It's not that much. A lot of people are shipping a 200kB gzipped bundle even after tree shaking 🙈.

I'm trying to check whether upgrading would help me cut down the bundle size significantly

significantly? No, it won't. It will most likely be smaller, but I have don't have any figure to share. I'm eager to know the figure once you complete the migration :).

I'm importing the colors like so

Color can be imported directly in v1.x to prevent including unneeded color. You can't do anything about it with v0.x.

I noticed that some components are included in the bundle which I'm not directly importing

They are transitive dependencies.

@mbrookes
Copy link
Member

@deepfriedbrain
Copy link
Author

Thank you, guys. I really appreciate your work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support: question Community support but can be turned into an improvement
Projects
None yet
3 participants