diff --git a/.changeset/afraid-seals-tan.md b/.changeset/afraid-seals-tan.md new file mode 100644 index 000000000000..a40615e8d16d --- /dev/null +++ b/.changeset/afraid-seals-tan.md @@ -0,0 +1,5 @@ +--- +"astro": patch +--- + +Fixes an issue where the dev server froze when typescript aliases were used. diff --git a/packages/astro/src/prerender/routing.ts b/packages/astro/src/prerender/routing.ts index 1c1b8382546a..29e02611e4e3 100644 --- a/packages/astro/src/prerender/routing.ts +++ b/packages/astro/src/prerender/routing.ts @@ -40,16 +40,16 @@ async function preloadAndSetPrerenderStatus({ matches, settings, }: PreloadAndSetPrerenderStatusParams): Promise { - const preloaded = await Promise.all( - matches.map(async (route) => { + const preloaded = new Array + for (const route of matches) { const filePath = new URL(`./${route.component}`, settings.config.root); - if (routeIsRedirect(route)) { - return { + preloaded.push({ preloadedComponent: RedirectComponentInstance, route, filePath, - }; + }); + continue; } const preloadedComponent = await preload({ pipeline, filePath }); @@ -64,9 +64,8 @@ async function preloadAndSetPrerenderStatus({ route.prerender = prerenderStatus; } - return { preloadedComponent, route, filePath }; - }) - ); + preloaded.push({ preloadedComponent, route, filePath }); + } return preloaded; }