Web Development·

Performance Optimization for Nuxt Applications

A developer's guide to optimizing Nuxt applications for speed — covering lazy loading, image optimization, bundle analysis, caching strategies, and Core Web Vitals.

A fast website is a competitive advantage. Google uses Core Web Vitals as a ranking factor, users abandon slow pages, and conversion rates drop measurably with every additional second of load time. If your Nuxt application isn't performing well, you're leaving traffic and revenue on the table.

Here are the optimization strategies we apply to every Nuxt project we build.

Measure Before You Optimize

Before changing anything, establish your baseline. Run these tools and record the numbers:

  • Google Lighthouse (in Chrome DevTools) — overall performance score, LCP, FID, CLS
  • WebPageTest.org — real-world loading waterfall and filmstrip
  • Google PageSpeed Insights — field data from real users via Chrome UX Report
  • Nuxt DevTools — component rendering times and payload sizes

Optimize the metrics that matter most: Largest Contentful Paint (LCP), First Input Delay (FID), and Cumulative Layout Shift (CLS).

Image Optimization

Images are typically the heaviest assets on any page. Nuxt Image makes optimization straightforward.

Use Nuxt Image module:

<NuxtImg
  src="/hero-image.jpg"
  width="800"
  height="400"
  format="webp"
  loading="lazy"
  sizes="sm:100vw md:80vw lg:800px"
/>

Best practices:

  • Use format="webp" for modern compression (30–50% smaller than JPEG)
  • Set explicit width and height to prevent layout shifts (CLS)
  • Use loading="lazy" for below-the-fold images
  • Use sizes attribute for responsive image loading — don't serve desktop images on mobile
  • Consider using an image CDN (Cloudinary, imgix) for dynamic resizing

Lazy Loading Components

Not every component needs to load immediately. Nuxt supports lazy-loading components with a simple naming convention:

<!-- This component loads only when it enters the viewport -->
<LazyHeavyChart :data="chartData" />

When to lazy-load:

  • Below-the-fold content (charts, maps, carousels)
  • Modals and dialog content
  • Third-party widgets (chat widgets, social embeds)
  • Components that depend on heavy libraries

Bundle Optimization

Large JavaScript bundles are the most common cause of slow interactivity. Analyze and reduce your bundle.

Analyze your bundle:

npx nuxi analyze

This generates a visual treemap showing exactly what's in your bundle and where the weight comes from.

Reduction strategies:

  • Tree-shaking: Ensure you import only what you use (import { debounce } from 'lodash-es' not import _ from 'lodash')
  • Dynamic imports: Load heavy libraries only when needed
  • Audit dependencies: Remove unused packages and replace heavy libraries with lighter alternatives
  • Externalize large libraries: If a library is loaded from a CDN, exclude it from your bundle

Server-Side Rendering Optimization

If you're using SSR, server response time directly impacts LCP.

Strategies:

  • Cache rendered pages using Nuxt's built-in cache layer or a reverse proxy (Nginx, Cloudflare)
  • Use route rules to statically pre-render pages that don't change frequently
  • Optimize data fetching — avoid sequential API calls, use parallel fetching with Promise.all()
  • Minimize server-side computation — move heavy processing to background jobs or edge functions

Route rules example:

// nuxt.config.ts
routeRules: {
  '/blog/**': { isr: 3600 }, // Revalidate blog posts every hour
  '/about': { prerender: true }, // Static at build time
  '/dashboard/**': { ssr: true }, // Always server-rendered
}

Font Optimization

Custom fonts can significantly impact load time and cause visible text flashing (FOUT/FOIT).

Best practices:

  • Use font-display: swap to show fallback text immediately
  • Self-host fonts instead of loading from Google Fonts (eliminates DNS lookup and connection overhead)
  • Subset fonts to include only the characters you need
  • Preload critical fonts:
<link rel="preload" href="/fonts/PublicSans.woff2" as="font" type="font/woff2" crossorigin>

Caching Strategy

Effective caching reduces server load and improves repeat-visit performance.

Multi-layer caching:

  1. CDN edge caching — static assets and pre-rendered pages cached globally
  2. Service worker — cache critical resources for offline support and instant loads
  3. API response caching — cache external API responses to reduce latency
  4. Browser caching — set appropriate Cache-Control headers for static assets

Third-Party Script Management

Analytics, chat widgets, and marketing pixels are often the biggest performance killers — and the hardest to optimize because you don't control them.

Strategies:

  • Load third-party scripts with defer or async
  • Use requestIdleCallback or setTimeout to delay non-critical scripts
  • Consider loading chat widgets only on specific pages (contact page, not the entire site)
  • Use Partytown to run third-party scripts in a web worker

Monitoring in Production

Performance optimization is not a one-time task. Monitor continuously:

  • Google Search Console — Core Web Vitals reports from real users
  • Real User Monitoring (RUM) — track actual performance experienced by visitors
  • Lighthouse CI — run performance audits on every deployment
  • Error tracking — catch runtime errors that affect user experience

Quick Wins Checklist

If you want immediate improvements, start here:

  • Enable Nuxt Image and convert images to WebP
  • Add loading="lazy" to below-the-fold images
  • Set explicit dimensions on all images and videos
  • Run npx nuxi analyze and remove unused dependencies
  • Enable gzip/brotli compression on your server
  • Add Cache-Control headers for static assets
  • Defer non-critical third-party scripts
  • Preload critical fonts and CSS

Want a professional performance audit for your Nuxt application? Contact us — we'll identify exactly what's slowing you down and fix it.