rainbow-me / rainbowkit

The best way to connect a wallet 🌈 🧰
https://rainbowkit.com
MIT License
2.41k stars 641 forks source link

[bug] Tree-shaking isn't taking place for unused features #2110

Open LufyCZ opened 2 months ago

LufyCZ commented 2 months ago

Is there an existing issue for this?

RainbowKit Version

2.1.2

wagmi Version

2.11.2

Current Behavior

In cases where AccountModal or ChainModal aren't used, their code is still fully bundled by webpack.

The worst "offender" is the normalize function viem reexports (at 25kb gzipped), which is (probably?) imported RainbowKitProvider -> ModalProvider -> AccountModal -> useProfile -> useMainnetEnsAvatar-> safeNormalize.

Expected Behavior

Rainbowkit should allow for the configuration of used/unused features, and structuring the code in such a way that disabled features are tree-shaked away.

Steps To Reproduce

No response

Link to Minimal Reproducible Example (CodeSandbox, StackBlitz, etc.)

No response

Anything else?

No response

magiziz commented 2 months ago

@LufyCZ Thanks for raising this issue. We'll look into how we can tree shake the components when they are not used 👍