rainbowkit icon indicating copy to clipboard operation
rainbowkit copied to clipboard

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

Open LufyCZ opened this issue 1 year ago • 3 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

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

LufyCZ avatar Jul 22 '24 06:07 LufyCZ

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

0xmkh avatar Jul 22 '24 13:07 0xmkh

@magiziz saw the PR was closed without reason, any updates? Thanks

LufyCZ avatar Oct 01 '24 08:10 LufyCZ

Any news? I have similar problems when seeing our bundles

gndelia avatar Apr 29 '25 02:04 gndelia