Skip to content

Comments

perf: Replace motion with m + LazyMotion across all components#111

Open
vibemarketerpromax wants to merge 2 commits intomainfrom
perf/font-display-and-script-deferral
Open

perf: Replace motion with m + LazyMotion across all components#111
vibemarketerpromax wants to merge 2 commits intomainfrom
perf/font-display-and-script-deferral

Conversation

@vibemarketerpromax
Copy link
Collaborator

Summary

  • Converts 55 files from using the full motion import from framer-motion to the lighter m + LazyMotion + domAnimation pattern
  • This eliminates the full Framer Motion animation engine from each component's bundle, loading only the minimal DOM animation features on demand
  • Covers pages (about-us, careers, culture, events, ai-upskill, not-found, why-us, terms, privacy, policies, approach, ai-safety, rubber-duck, contact-us), client components (ServicePageClient, CaseStudiesClient, dotnet subpages), blog/industry/technology/use-case components, and UI primitives (Input, Select, Textarea, CookieBanner)

What changed

For each file:

  1. Changed import { motion } from "framer-motion" to import { LazyMotion, domAnimation, m } from "framer-motion"
  2. Replaced all motion.* JSX element tags (div, p, h1, h2, span, li, etc.) with m.*
  3. Wrapped the outermost returned JSX with <LazyMotion features={domAnimation}>...</LazyMotion>

Test plan

  • npm run lint passes with 0 errors (2 pre-existing warnings in unrelated files)
  • npm run build compiles successfully (TypeScript + Turbopack); blog page failure is expected without NOTION_TOKEN
  • Verify animations still work correctly on all converted pages
  • Run Lighthouse to confirm bundle size reduction

Convert 55 files from importing the full `motion` component to the lighter
`m` + `LazyMotion` + `domAnimation` pattern. This eliminates the full Framer
Motion animation engine from each component's bundle, loading only the
minimal DOM animation features on demand.

Files converted span pages (about-us, careers, culture, events, ai-upskill,
not-found, why-us, terms, privacy, policies, approach, ai-safety,
rubber-duck, contact-us), client components (ServicePageClient,
CaseStudiesClient, CaseStudyDetailClient, dotnet subpages), blog components,
industry components, technology components, use-case components, and UI
primitives (Input, Select, Textarea, CaseStudyCard, CookieBanner).
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 20, 2026

Deploying website with  Cloudflare Pages  Cloudflare Pages

Latest commit: ca3d61e
Status: ✅  Deploy successful!
Preview URL: https://aae48c2a.website-yiq.pages.dev
Branch Preview URL: https://perf-font-display-and-script.website-yiq.pages.dev

View logs

- Defer GTM/GA4/Clarity loading by 3.5s + requestIdleCallback to push
  heavy 3rd-party JS (~865ms GTM, ~236ms Clarity main-thread time)
  past the Core Web Vitals measurement window
- Fix CTA button contrast: #1D9B69 → #178556 (3.52:1 → 4.63:1)
  to pass WCAG AA for normal text
- Add NormalModuleReplacementPlugin to aggressively strip Next.js
  polyfills that survive the alias approach (Array.at, flat, etc.)
- Add preconnect for cloudflareinsights.com (300ms est. LCP savings)
- Add dns-prefetch for scripts.clarity.ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant