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:
parent
51b6ff7403
commit
4bcc249a9f
2 changed files with 12 additions and 8 deletions
5
.changeset/afraid-seals-tan.md
Normal file
5
.changeset/afraid-seals-tan.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"astro": patch
|
||||
---
|
||||
|
||||
Fixes an issue where the dev server froze when typescript aliases were used.
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue