-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[Modal] -74% bundle size reduction when used standalone #15466
Conversation
e55d564
to
77643b4
Compare
@material-ui/core: parsed: 0.00% 😍, gzip: +0.17% Details of bundle changes.Comparing: 387b79e...fa21113
|
77643b4
to
5cd7814
Compare
5cd7814
to
fa21113
Compare
@oliviertassinari just a question: Why did the bundle grow (gzip: +0.17%), if the Modal shrank? |
@eluchsinger It's because of a simplified default backdrop. |
Also, we shouldn't look at the gzipped diff that much. It dependents on the heuristic the compressions the algorithm uses. The parsed one is often more "stable" (more stability to code changes). |
I wanted to try this change for months! #5750 gave me enough energy to start. The core idea behind this change is that we document the Modal component as a good starting point to build a Modal (outside of Material Design). This vision can only be achieved with an outstanding small bundle size.
This change doesn't help people already using @material-ui/styles and our theme. But it reduces the entry cost for new developers. A developer can progressively add our generic components, with only paying for what he needs.
From 23.4 kB gzipped to 6.5 kB gzipped. We can still do better. The react hooks migration will help. We should be able to go down to 5.5 kB.
Breaking change
Remove the classes customization API for the Modal component.