family / connectkit

Connecting a wallet, made simple.
https://docs.family.co/connectkit
BSD 2-Clause "Simplified" License
872 stars 188 forks source link

[Optimization] Reduce bundle size #231

Closed TimDaub closed 1 year ago

TimDaub commented 1 year ago

Initial conversation: https://warpcast.com/timdaub/0x1905b4

https://www.framer.com/motion/guide-reduce-bundle-size/

npm ls framer-motion web@0.0.0 /Users/timdaub/Projects/attestate/kiwistand/src/web └─┬ connectkit@1.2.4 └── framer-motion@6.5.1

and so I looked into connectkit's usage of framer motion and saw some optimization potential (e.g. using "m" instead of "motion". Are you interested in me applying the changes from that blog post?

https://github.com/search?q=repo%3Afamily%2Fconnectkit%20framer-motion&type=code

lochie commented 1 year ago

Hey @TimDaub! You're welcome to give optimisations a shot and we can give it a look, but worth mentioning that I've spent some time previously trying to migrate motion to m but this seemed to only save us about 20-30kbs, and it also caused some animation issues.

Worth noting that we eventually would like to look into removing framer-motion in the future to lower the file size of ConnectKit, and there's also a few other optimisations that could be done with SVGs and some minor refactoring that we have in our internal to-do list.