-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
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
Bundling MUI w/ Pigment CSS results in large JavaScript chunks #44113
Comments
In general, we are talking about two different things here, runtime performance vs bundle size. In general, we made a decision to make the theme available in the runtime too for some use-cases, like having access to it in the rendering logic etc. So, I would say that part of the bundle size increase is expected. In terms of how much code is being executed during runtime, from my understanding all of it is related to:
So zero-runtime namely means that there is no logic in generating stylesheet during runtime - this is the thing that is different than Emotion. @brijeshb42 can correct me or expand further. Now, we may need to document these things so we don't set false expectations. A question - have you compared a plain app using Emotion vs Pigment CSS? Is this related to adding Material UI too in the bundle? We can likely move this issue to the Pigment CSS repository |
Current bundle size for |
Idk whether this issue can be improved by rethinking how you use the PigmentCSS’ API (styled vs css), or by optimizing runtime implications of the
On a side note, for my use case, the JS only size of an app actually grew in size after switching from Emotion to PigmentCSS. For me, what worked to remove emotion completely was setting
|
I mean to decrease use of emotion in a medium project with a lot of MUI components to 2.32KB gzipped as in the provided reproduction example |
Steps to reproduce
Link to live example
Steps:
rollup-plugin-visualizer
so you could visualize the resulting bundlenpm run build
rollup-plugin-visualizer
(see example below)Current behavior
zero-runtime-theme.js
is 7.16KB gzipped@pigment-css/react/build
is 6.74KB gzippedTotal: 16.22KB gzipped
Expected behavior
Smaller JavaScript footprint
Context
We should evaluate the runtime implications of some PigmentCSS' API usage, such as:
styled
that results in extra JS outputYour environment
npx @mui/envinfo
Search keywords: pigmentcss, pigment, bundling, final, emotion, zero runtime
The text was updated successfully, but these errors were encountered: