Is EUI tree-shakeable? #5386
-
I couldn't find any documentation about whether eui is tree-shakeable or not. Is there somewhere that document things we can do to reduce bundle size? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
@chandlerprall might have some more details. On a broader note, though, we are working towards making EUI modular, but that is definitely a long-term effort. |
Beta Was this translation helpful? Give feedback.
-
Confirmed again via create-react-app, started with new project & added EUI+dependencies, then imported & used just the EuiButton component. Dev experience ( There's nothing special about tree-shaking for EUI (or shouldn't be, and that appears to be true). The webpack docs have a tree shaking guide which has always worked for me with EUI on custom, non-create-react-app projects. For completeness, I should mentioned that the CSS bundle we provide is never pruned. |
Beta Was this translation helpful? Give feedback.
This comment has been hidden.
This comment has been hidden.
-
Can anyone tell me how to do tree-shaking on vite? |
Beta Was this translation helpful? Give feedback.
Confirmed again via create-react-app, started with new project & added EUI+dependencies, then imported & used just the EuiButton component. Dev experience (
yarn start
) loads 10.7mb of resources while the production build (yarn build
) only loads 241kb.There's nothing special about tree-shaking for EUI (or shouldn't be, and that appears to be true). The webpack docs have a tree shaking guide which has always worked for me with EUI on custom, non-create-react-app projects.
For completeness, I should mentioned that the CSS bundle we provide is never pruned.