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

Reduce bundle size for Material-UI #1699

Open
sdellis opened this issue Jan 25, 2019 · 4 comments
Open

Reduce bundle size for Material-UI #1699

sdellis opened this issue Jan 25, 2019 · 4 comments

Comments

@sdellis
Copy link
Contributor

sdellis commented Jan 25, 2019

Explore babel-plugin-import option (or even better, webpack treeshaking) discussed here.

@sdellis
Copy link
Contributor Author

sdellis commented Jan 28, 2019

With Webpack resolve/alias was able to reduce it by around 7K. LOL.

So, it looks like we should be targeting ES6, not umd for our builds if we want to do tree shaking... these should be separate builds. Oh, also there's this:

If you want to create a tree-shakable library, you cannot bundle it with webpack.

one-does-not-simply-treeshake-front-end-app

@camillevilla
Copy link
Member

@sdellis I'm sure you're already a pro at bundle analysis, but Jack added a lil' script nicety in #1708 that might be useful.

@sdellis
Copy link
Contributor Author

sdellis commented Jan 29, 2019

@camillevilla I'm definitely not a pro on this. I tried out the size-limit script @mejackreed added. Are we ok with the minimized bundle being > 1MB if gzipped at under < 300KB? When running with the --why argument, I only see the mirador bundle, not all the dependencies. I think this is because a umd build doesn't allow for that kind of insight. We will need to use the Material-UI ES6 distribution to get tree shaking to work like that. We will need to produce our own ES6 distribution if we want to allow tree shaking of the Mirador 3 library.

@sdellis
Copy link
Contributor Author

sdellis commented Feb 5, 2019

Additional discussion around tree shaking the Material-UI bundle can be found here:
#1635 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants