0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

fix(dev): preload matched routes sequentially (#10116)

* fix(dev): preload matched routes sequentially

* add changeset
This commit is contained in:
Arsh 2024-02-14 15:27:53 -07:00 committed by GitHub
parent 51b6ff7403
commit 4bcc249a9f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 8 deletions

View file

@ -0,0 +1,5 @@
---
"astro": patch
---
Fixes an issue where the dev server froze when typescript aliases were used.

View file

@ -40,16 +40,16 @@ async function preloadAndSetPrerenderStatus({
matches,
settings,
}: PreloadAndSetPrerenderStatusParams): Promise<PreloadAndSetPrerenderStatusResult[]> {
const preloaded = await Promise.all(
matches.map(async (route) => {
const preloaded = new Array<PreloadAndSetPrerenderStatusResult>
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;
}