Corrections visuel ; optimisation du chargement des pages (préchargement anticité, sinon temps de latence chaque fois qu'on visite un type de page une première fois)

This commit is contained in:
2026-04-22 13:17:05 +02:00
parent 8f4dd3e9d6
commit 8efa148739
13 changed files with 385 additions and 34 deletions

View File

@@ -1,9 +1,17 @@
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app/app.component';
import { provideRouter } from '@angular/router';
import { PreloadAllModules, provideRouter, withPreloading } from '@angular/router';
import { routes } from './app/app.routes';
import { provideHttpClient } from '@angular/common/http';
// withPreloading(PreloadAllModules) : une fois l'app initiale rendue, Angular
// telecharge en arriere-plan tous les chunks lazy-loades. Consequence : la
// premiere visite d'une route ne declenche plus de download runtime, elle
// ouvre instantanement. Cout : un peu plus de bande passante au demarrage
// (acceptable pour une app interne ou toutes les routes seront visitees).
bootstrapApplication(AppComponent, {
providers: [provideRouter(routes), provideHttpClient()]
providers: [
provideRouter(routes, withPreloading(PreloadAllModules)),
provideHttpClient(),
],
}).catch((err: Error) => console.error(err));