-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Optimize package size #2531
Comments
Aware, we will address this, ATM this JS is dynamically imported. |
How are you measuring this? @mlenser RainbowKit is bigger but can fool some tools because of dynamic importing on page load. We have a lot of features in AppKit, you can try by disabling what you won't be using. We will release v6 soon and a lot of these should be addressed. |
The first images are bundlephobia. The web3modal libs combined are |
The analysis on Web3Modal is accurate but the one in RainbowKit is not, bundlefophia is pretty bad for this context and doesn't give you the full bundle size of RainbowKit. Web3Modal is not 200kb though it's like 700kb, RainbowKit is around the same size. We are using this, would love your input |
The sizes mentioned above are gzipped sizes which is what nextjs and other tools use as a comparison. I've created a repo which shows the bundle size comparisons.
Both apps use a custom connect button.
Conclusions based on the actual nextjs numbers:
|
Vite let's you visualize the split code but it gives you the full bundle size (it doesn't filter dynamic imported files). Next will only show the first load ( Anyways, dynamic importing is good practice when necessary and I do agree that AppKit right now is HUGE. v6 should reduce this drastically and we'll keep working on improving this. |
Thank you for looking into this. Rainbow definitely could be loading things after the initial load. That first initial load is the most important so deferring some of the UI on I look forward to v6. Do you guys have any blogs on it or some general release timeframe? |
you can follow the PR here: |
I tried the latest It added ~340kB to my layout file and that's after replacing rainbowkit (~60kB). If I compare prod vs appkit builds the layout is not listed and everything seems slightly better overall
I compared the bundle itself:
The total chunk size is 5.56MB on prod and 4.84 MB with Appkit (parsed, not gzipped sizes in this case). However, the largest chunk for Appkit is 362 KB (1.42MB not gzipped), which dwarfs any previous chunks. That chunk is definitely getting to the users and would impact them aversely. Some issues with the appkit bundle:
What it really boils down to is |
Quick notes on reducing bundle size: Use native javascript bigInt
Use noble crypto instead of
|
also the problem of splitting into a large number of packages vite vue vendor chunk: 'reown-appkit': [
// hidden deps
'@reown/appkit-common',
'@reown/appkit-polyfills',
'@reown/appkit-scaffold-ui',
'@reown/appkit-siwe',
'@reown/appkit-ui',
'@reown/appkit-utils',
'@reown/appkit-wallet',
// real
'@reown/appkit',
'@reown/appkit-adapter-wagmi',
], |
Replacing
@solana/wallet-adapter-walletconnect
with@walletconnect/[email protected]
adds around 1.5 mb to my bundle. (before compression)That is way too much for a wallet connector, especially since vite/rollup now struggles with separating imports, the size of my bundles main .js file has doubled!
The text was updated successfully, but these errors were encountered: