[BUG] Significant bundlesize increase with framer-motion@5 while using LazyMotion
See original GitHub issue1. Read the FAQs 👇
2. Describe the bug
With the upgrade to framer/motion@5 we’re seeing a significant bundle size increase. I understand that the new version offers lots of cool functionality so that there is an increase in bundle size could be expected. I wouldn’t expect his however when using LazyMotion,
Page | Size old | Size new | Size diff | First load old | First load new | First load diff |
---|---|---|---|---|---|---|
/ | 2.1kB | 2.1kB | 242kB | 249.0kB | +7kB🚨 | |
/_app | 152kB | 164.0kB | +12kB🚨 | |||
/[…url] | 4.3kB | 4.3kB | 260kB | 266.0kB | +6kB🚨 | |
/404 | 6.4kB | 6.3kB | -0.1kB | 228kB | 235.0kB | +7kB🚨 |
/about/[url] | 2.7kB | 2.7kB | 223kB | 230.0kB | +7kB🚨 | |
/account | 15.0kB | 13.6kB | -1.4kB | 210kB | 220.0kB | +10kB🚨 |
/account/addresses | 12.5kB | 9.8kB | -2.7kB | 220kB | 224.0kB | +4kB⚠️ |
We’re already using the LazyMotion
feature and I would thus expect for the bundle size not too increase significantly.
4. Steps to reproduce
Steps to reproduce the behavior:
- Upgrade to framer motion 5
- See the difference in bundlesize
- See error
5. Expected behavior
Bundle size is not increased, and the additional features are loaded lazily
6. Video or screenshots
Not applicable
7. Environment details
Not applicable
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:11
Top Results From Across the Web
LazyMotion | Framer for Developers
The LazyMotion component can help you reduce bundle size by synchronously or asynchronously loading some, or all, of the motion component's features.
Read more >Framer-Motion: New And Underestimated Features - Shakuro
Documentation states, that default use of motion component adds around 25kb to the bundle size vs under 5kb for LazyMotion and m components....
Read more >Sebastien Lorber • ⚛️ ThisWeekInReact.com on Twitter ...
Reducing bundle size by extracting error messages from code, similarly to ReactJS. Redux Toolkit Query is being added to Redux Toolkit This will...
Read more >Error importing Framer Motion v5 in React (with create-react ...
I downgraded the Framer motion version to "4.1.17" by changing the package.json file and running npm install and it works for me.
Read more >How to Reduce Your Webpack Bundle Size for Web App ...
If you have been in Web Development for a quite some time for now especially as a Front-End Developer and you use Webpack...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This fixed the issue! https://github.com/graphcommerce-org/graphcommerce/pull/1550#issuecomment-1180401005
@mattgperry this might be interesting https://github.com/vercel/next.js/issues/33394#issuecomment-1175900933