Performance: Lazy loading routes
HIGH IMPACT
This affects the initial page load speed by deferring loading of route components until needed.
const routes = [ { path: '/', component: () => import('./views/Home.vue') }, { path: '/about', component: () => import('./views/About.vue') } ];
import Home from './views/Home.vue'; import About from './views/About.vue'; const routes = [ { path: '/', component: Home }, { path: '/about', component: About } ];
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Eager loading routes | N/A (no extra DOM nodes) | 0 | Higher paint cost due to larger JS bundle delaying first paint | [X] Bad |
| Lazy loading routes | N/A (no extra DOM nodes) | 0 | Lower paint cost due to smaller initial JS bundle | [OK] Good |