framer-motion has a well known tax and a well known way of avoiding it. If you import motion you get the whole animation engine, because motion.div has to support every feature anyone might pass it. If you import m instead, you get a component with no features at all, and you choose what to load by wrapping a subtree in LazyMotion:

import { LazyMotion, domAnimation, m } from 'framer-motion' <LazyMotion features={domAnimation}> <m.div animate={{ opacity: 1 }} /> </LazyMotion> 

The library ships its own size fixtures, so the difference is not a matter of opinion. From framer-motion@12.40.0 in our own node_modules:

fixture raw gzipped
size-rollup-dom-animation-m.js (m plus domAnimation) 7,341 3,150
size-rollup-dom-animation.js 37,331 13,938
size-rollup-dom-max.js 84,742 27,488
size-rollup-motion.js (plain motion) 123,572 39,455

We knew all of this. I went and counted what we actually do.

The count

Across app/, components/ and hooks/, 32 files import from framer-motion:

  • 26 import m
  • 9 render a LazyMotion provider, 8 of them with domAnimation
  • 1 uses domMax
  • 7 use AnimatePresence, 5 use MotionConfig
  • 1 imports motion

Twenty-six to one. The whole game screen, every mascot, every effect, the player's phone, the landing page demo: all m, all inside a provider. One file did not get the memo, and it is this one:

"use client" import { motion, useScroll, useTransform } from "framer-motion" export function FooterWordmark() { // ...walk up to the <footer> ancestor, track scroll through it const y = useTransform(scrollYProgress, [0, 1], ["60%", "0%"]) const opacity = useTransform(scrollYProgress, [0, 0.3, 1], [0, 0.02, 0.05]) return ( <span aria-hidden="true" className="hidden md:flex absolute inset-x-0 bottom-0 ..."> <motion.span style={{ y, opacity, fontSize: "clamp(6rem, 18vw, 18rem)" }}> PubTrivia </motion.span> </span> ) } 

It is the enormous faint wordmark that slides up behind the footer as you reach the bottom of a page. Read the two useTransform calls carefully, because they are the funniest part of this post: the opacity ends at 0.05. The element is aria-hidden. It is hidden md:flex, so it does not exist on a phone at all.

And its three call sites are the homepage, the about page, and ContentPage, the shell that 106 of our page.tsx files render inside. Our live sitemap lists 111 URLs. One motion import reaches 108 of them, and the only three it misses are the legal pages, which get a different footer.

What it costs on the live site

This is measurable from outside, so here is the measurement rather than an estimate. Every public page's <script src> tags, fetched twice, once plain and once with Accept-Encoding: br:

page chunks raw JS brotli JS chunks containing framer-motion
/guides 19 1,262,424 404,862 3
/legal/privacy 14 966,132 304,804 0
/login 15 987,129 312,857 0

The three legal pages are the control group, and they are a good one: same app, same build, same header, same fonts, but they get a compact footer with no wordmark in it. They ship 14 chunks and not one of those chunks contains framer-motion code. A guide page ships 19 chunks, and three of them do: 205,129 raw bytes, 67,610 bytes over the wire after brotli.

I identified those three by downloading every chunk and grepping for strings the library cannot minify away, because they are public prop names and feature flags:

  • 93,022 bytes, containing whileTap (7), whileInView (5), projection (15), MeasureLayout (4)
  • 48,649 bytes, containing layoutDependency (8) and projection (38)
  • 63,458 bytes, containing scrollYProgress (4)

projection and MeasureLayout are the layout animation engine. whileTap and whileInView are gesture and viewport features. A page of prose with one decorative word on it is loading all of it, because motion.span cannot know that all we want is a transform and an opacity.

The one place domMax is right

While counting I found the opposite case, and it is worth keeping as a reference point for how fiddly this API is. The host screen's leaderboard animates row reordering with framer's layout prop, which needs the projection engine that domAnimation deliberately leaves out. So it carries its own provider:

import { LazyMotion, domMax, m } from 'framer-motion' // ... <LazyMotion features={domMax}> 

That component renders inside the host controller, which already has a LazyMotion features={domAnimation} around everything. So there is a domMax provider nested inside a domAnimation provider, which looks like a mistake and is not. LazyMotion passes its feature set down through context, and the nearest provider is the one that wins for its subtree. Since domMax is a superset of domAnimation, the nested subtree loses nothing, and keeping the bigger feature set nested rather than promoting it to the top of the tree is what stops the layout engine loading on screens that never reorder a row.

There is a second honest exception. The admin mailing composer uses Reorder.Group and Reorder.Item for drag-to-sort blocks, with no provider at all, because Reorder is built on full motion internally and there is no m equivalent. That page is behind a login and an allowlist, so it costs the public site nothing. It is still the reason you cannot state the rule as "we never import the full bundle".

What we are doing about it

Two options, and they are not equally good:

  1. Swap motion.span for m.span and wrap it in LazyMotion features={domAnimation}. By the library's own fixtures that is 3,150 gzipped bytes instead of 39,455, and the scroll hooks still work. One line of import, one wrapper, no visual change.
  2. Delete framer-motion from that component entirely. What it does is a scroll-linked transform and fade, which is animation-timeline: view() in CSS. Nothing about the effect needs JavaScript at all, and the effect is aria-hidden and decorative, which is exactly the kind of thing to let the compositor own.

We are taking the second one, with the first as the fallback for browsers without scroll-driven animations. The reason to write the post before the fix is that the finding is the interesting part: we were disciplined 26 times out of 27, and the one exception landed in the shared page shell, which is the single worst place to be careless. Bundle discipline is not about the components you think about. It is about the ones that render everywhere.

Check it yourself

  • Scroll to the bottom of pub-trivia.app/guides and watch the giant faint word slide up behind the footer links. That is the whole payload.
  • Now scroll to the bottom of pub-trivia.app/legal/privacy. No wordmark, because that page gets the compact footer.
  • Open DevTools, Network, filter to JS, and reload both. The guide page asks for 19 scripts, the privacy page 14. Search any chunk for scrollYProgress and you will find which one carries the scroll feature.
  • The landing page at pub-trivia.app is where the disciplined 26 live: the running host screen under the headline is all m components inside one LazyMotion provider, which is why it animates continuously and is not what makes the page heavy.