diff --git a/packages/astro/src/prerender/routing.ts b/packages/astro/src/prerender/routing.ts index 29e02611e4e3..d8250b98ffe4 100644 --- a/packages/astro/src/prerender/routing.ts +++ b/packages/astro/src/prerender/routing.ts @@ -40,32 +40,32 @@ async function preloadAndSetPrerenderStatus({ matches, settings, }: PreloadAndSetPrerenderStatusParams): Promise { - const preloaded = new Array - for (const route of matches) { - const filePath = new URL(`./${route.component}`, settings.config.root); - if (routeIsRedirect(route)) { - preloaded.push({ - preloadedComponent: RedirectComponentInstance, - route, - filePath, - }); - continue; - } - - const preloadedComponent = await preload({ pipeline, filePath }); - - // gets the prerender metadata set by the `astro:scanner` vite plugin - const prerenderStatus = getPrerenderStatus({ + const preloaded = new Array(); + for (const route of matches) { + const filePath = new URL(`./${route.component}`, settings.config.root); + if (routeIsRedirect(route)) { + preloaded.push({ + preloadedComponent: RedirectComponentInstance, + route, filePath, - loader: pipeline.getModuleLoader(), }); + continue; + } - if (prerenderStatus !== undefined) { - route.prerender = prerenderStatus; - } + const preloadedComponent = await preload({ pipeline, filePath }); - preloaded.push({ preloadedComponent, route, filePath }); + // gets the prerender metadata set by the `astro:scanner` vite plugin + const prerenderStatus = getPrerenderStatus({ + filePath, + loader: pipeline.getModuleLoader(), + }); + + if (prerenderStatus !== undefined) { + route.prerender = prerenderStatus; } + + preloaded.push({ preloadedComponent, route, filePath }); + } return preloaded; }