Performance: Project structure
MEDIUM IMPACT
Project structure affects how quickly the browser can load and render the app by influencing code splitting and lazy loading.
src/
App.svelte
components/
Header.svelte
Footer.svelte
routes/
+page.svelte (Home)
about/
+page.svelte
contact/
+page.svelte
// Use SvelteKit file-based routing with dynamic imports for lazy loading routessrc/
App.svelte
components/
Header.svelte
Footer.svelte
routes/
Home.svelte
About.svelte
Contact.svelte
// All components imported eagerly in App.svelte| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Monolithic project with eager imports | Low (few nodes initially) | Low (few layout changes) | High (large JS bundle delays paint) | [X] Bad |
| Modular project with lazy-loaded routes | Low (few nodes initially) | Low (few layout changes) | Low (small JS bundle, faster paint) | [OK] Good |