Skip to content

Commit

Permalink
Respect initial prerender option from injectRoute
Browse files Browse the repository at this point in the history
  • Loading branch information
bluwy committed Sep 25, 2024
1 parent d765220 commit 8943110
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/astro/src/vite-plugin-scanner/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,16 @@ async function getPageOptions(
settings: AstroSettings,
logger: Logger,
): Promise<PageOptions> {
const fileUrlStr = fileURL.toString();
const injectedRoute = settings.resolvedInjectedRoutes.find(
(route) => route.resolvedEntryPoint && fileUrlStr === route.resolvedEntryPoint.toString(),
);

// Run initial scan
const pageOptions = await scan(code, id, settings);
const pageOptions =
injectedRoute?.prerender != null
? { prerender: injectedRoute.prerender }
: await scan(code, id, settings);

// Run integration hooks to alter page options
const route: RouteOptions = {
Expand Down

0 comments on commit 8943110

Please sign in to comment.