Skip to content

Commit

Permalink
perf(@angular-devkit/build-angular): disable ahead of time prerenderi…
Browse files Browse the repository at this point in the history
…ng in vite dev-server

When using the devserver, instead of prerendering every page for every incremental change, we now perform a server rendering on the page during request time. This ensures that incremental build times are faster when prerending is enabled as we avoid rendering of pages that are never viewed.
  • Loading branch information
alan-agius4 committed Sep 22, 2023
1 parent 39b1976 commit 61f409c
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ export async function* serveWithVite(
} as json.JsonObject & BrowserBuilderOptions,
builderName,
)) as json.JsonObject & BrowserBuilderOptions;

if (browserOptions.prerender) {
// Disable prerendering if enabled and force SSR.
// This is so instead of prerendering all the routes for every change, the page is "prerendered" when it is requested.
browserOptions.ssr = true;
browserOptions.prerender = false;
}

// Set all packages as external to support Vite's prebundle caching
browserOptions.externalPackages = serverOptions.cacheOptions.enabled;

Expand Down

0 comments on commit 61f409c

Please sign in to comment.