Performance: Pages and file-based routing
MEDIUM IMPACT
This affects the initial page load speed and navigation responsiveness by controlling how routes are resolved and components are loaded.
const routes = [ { path: '/', component: () => import('./pages/Home.vue') }, { path: '/about', component: () => import('./pages/About.vue') } ];
import Home from './pages/Home.vue'; import About from './pages/About.vue'; const routes = [ { path: '/', component: Home }, { path: '/about', component: About } ];
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Eager import of all pages | Low (few nodes initially) | 1 reflow on load | High paint cost due to large bundle | [X] Bad |
| Lazy load pages with file-based routing | Low (few nodes initially) | 1 reflow on load | Lower paint cost due to smaller bundle | [OK] Good |