0
0
Vueframework~8 mins

Static site generation with Nuxt in Vue - Performance & Optimization

Choose your learning style9 modes available
Performance: Static site generation with Nuxt
HIGH IMPACT
Static site generation improves page load speed by pre-building HTML pages, reducing server work and client rendering time.
Delivering fast initial page load for a Vue app
Vue
export default { target: 'static', ssr: true /* enable static site generation */ }
Pages are pre-rendered to static HTML at build time, so browsers show content immediately.
📈 Performance GainReduces LCP by up to 70%; no JS needed for initial paint; faster time to interactive.
Delivering fast initial page load for a Vue app
Vue
export default { ssr: false /* client-side rendering only */ }
Pages are rendered on the client, causing slower initial load and higher CPU use on user devices.
📉 Performance CostBlocks rendering until JS loads and runs; increases LCP by 1-3 seconds on slow networks.
Performance Comparison
PatternDOM OperationsReflowsPaint CostVerdict
Client-side rendering onlyMany DOM updates after JS loadsMultiple reflows during hydrationHigh paint cost due to delayed content[X] Bad
Static site generation with NuxtMinimal DOM updates on loadSingle reflow on initial paintLow paint cost with immediate content[OK] Good
Rendering Pipeline
Static site generation outputs ready HTML files, so the browser skips server rendering and heavy JS execution for first paint.
HTML Parsing
Style Calculation
Layout
Paint
⚠️ BottleneckServer-side rendering at request time is eliminated, reducing server response delays.
Core Web Vital Affected
LCP
Static site generation improves page load speed by pre-building HTML pages, reducing server work and client rendering time.
Optimization Tips
1Pre-build pages to serve static HTML and reduce server response delays.
2Avoid client-only rendering for main content to improve LCP.
3Use Nuxt's static target to minimize JavaScript blocking initial paint.
Performance Quiz - 3 Questions
Test your performance knowledge
How does static site generation with Nuxt affect Largest Contentful Paint (LCP)?
AIt delays LCP because pages render on the client.
BIt has no effect on LCP.
CIt improves LCP by serving pre-built HTML quickly.
DIt worsens LCP by adding extra server processing.
DevTools: Performance
How to check: Record page load and look for time to first contentful paint and scripting time.
What to look for: Short time to first contentful paint and minimal scripting blocking indicate good static generation.