Performance: Nuxt project structure
MEDIUM IMPACT
This affects the initial page load speed and rendering performance by organizing how components, pages, and assets are loaded and rendered.
pages/
index.vue
about.vue
components/
Header.vue
Footer.vue
BigComponent.vue
// Use automatic component import or lazy load BigComponent only where neededpages/
index.vue
about.vue
components/
Header.vue
Footer.vue
BigComponent.vue
// All components imported globally in nuxt.config.js| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Global import of all components | Low | Low | High due to large JS bundle | [X] Bad |
| Lazy loading components per page | Low | Low | Low due to smaller JS bundles | [OK] Good |
| Static assets in assets folder referenced relatively | N/A | N/A | Blocks paint until loaded | [!] OK |
| Static assets in public folder with caching | N/A | N/A | Non-blocking paint with caching | [OK] Good |