0
0
Astroframework~8 mins

Vue components in Astro - Performance & Optimization

Choose your learning style9 modes available
Performance: Vue components in Astro
MEDIUM IMPACT
Using Vue components in Astro affects page load speed and interaction responsiveness by adding client-side JavaScript and hydration costs.
Integrating Vue components in an Astro page
Astro
---
import MyVueComponent from '../components/MyVueComponent.vue';
---
<MyVueComponent client:idle />
Delays hydration until browser is idle, reducing initial JS load and improving interaction readiness.
📈 Performance GainReduces blocking JS on load; improves INP by 20-40%; smaller initial JS payload
Integrating Vue components in an Astro page
Astro
---
import MyVueComponent from '../components/MyVueComponent.vue';
---
<MyVueComponent client:load />
Using client:load hydrates the Vue component immediately on page load, adding JavaScript and delaying interactivity.
📉 Performance CostBlocks interaction until hydration completes; adds 30-50kb JS bundle; increases INP metric
Performance Comparison
PatternDOM OperationsReflowsPaint CostVerdict
client:load hydrationHydrates full component DOMTriggers 1 reflow per componentModerate paint cost due to JS execution[X] Bad
client:idle hydrationHydrates component DOM after idleSingle reflow delayedLower paint cost, less blocking[OK] Good
Rendering Pipeline
Astro renders Vue components to static HTML on the server, then hydrates them on the client based on hydration directives. Hydration triggers JavaScript parsing, execution, and DOM updates.
JavaScript Parsing
Hydration
Layout
Paint
⚠️ BottleneckHydration JavaScript execution delays interactivity
Core Web Vital Affected
INP
Using Vue components in Astro affects page load speed and interaction responsiveness by adding client-side JavaScript and hydration costs.
Optimization Tips
1Avoid client:load hydration for large Vue components to reduce blocking JavaScript.
2Use client:idle or client:visible to defer hydration and improve interaction speed.
3Server-side render Vue components in Astro to improve initial content paint (LCP).
Performance Quiz - 3 Questions
Test your performance knowledge
What is the main performance cost of using client:load hydration for Vue components in Astro?
AStatic HTML rendering delays initial paint
BHydration JavaScript blocks interaction until complete
CCSS stylesheets load slower
DImages inside Vue components load late
DevTools: Performance
How to check: Record a performance profile while loading the page with Vue components in Astro. Look for long tasks related to hydration and JS execution.
What to look for: Long scripting tasks delaying Time to Interactive and INP; large JS bundles in Network panel