The theme object inflates bundle size.
cihad opened this issue · comments
Description
theme
object gets total 9 colorSchemes
. And importing these color schemes under the themes
object does not allow tree shaking. I bundled only theme object:
Only theme object took 327 Kb | gzip: 52 Kb.
I recommend export each color scheme something like import { light, dark } fro "@primer/react/color-schemes"
. And it can be pass the <ThemeProvider>
as generated theme object. Because overall UI's don't need more than 2 schemes.
Steps to reproduce
- Go to Stackblitz example
- Run
npm run build
- See the results.
Version
^36.12.0
Browser
No response
Hi! Thanks for taking the time to report this!
Good news: This current solution is temporary and we are already discussion a replacement which should lead to a much smaller bundlesize (not too dissimilar than the one you suggested)
Bad news: It's still in the planning phase so I don't have a exact date for you right now when that change will happen
Until then, I'm not sure if there is an easy workaround 🤔