Skip to main content
Back to Log
May 22, 2025

Optimizing Core Web Vitals in Heavy Next.js Applications

Practical strategies for scoring 95+ on Google Lighthouse in Next.js applications that heavily utilize Framer Motion and GSAP.

Building highly interactive, animation-heavy marketing sites often comes at the cost of performance. Browsers struggle to parse large JavaScript bundles quickly, leading to poor Largest Contentful Paint (LCP) and Interaction to Next Paint (INP) scores.

Here is how we maintain a premium aesthetic without sacrificing Core Web Vitals.

Dynamic Imports for Heavy Libraries

Instead of importing heavy animation libraries globally, we use Next.js dynamic imports to lazy-load them only when they enter the viewport.

import dynamic from 'next/dynamic'

// Only load the massive Three.js model when the user scrolls to it

const Heavy3DScene = dynamic(() => import('./scene'), { ssr: false })

CSS Over JS for Initial Load

We ensure that the initial viewport (above the fold) uses CSS animations or highly optimized inline styles for its initial state, deferring React hydration until after the first paint. This drastically improves the perceived load time.

Start a project · Free quote

LET'SBUILD.

Leave your email or number and a one-line brief. You'll hear back from an engineer — not a salesperson — within 24 hours, with a clear plan and a quote.

24-hour reply No obligation 200+ businesses built

Suite from ₹250/mo · Labs from ₹10,000 · see full pricing

We only use this to reply about your project. No spam, no lists.