Skip to content

Commit

Permalink
fix(dev): preload matched routes sequentially (#10116)
Browse files Browse the repository at this point in the history
* fix(dev): preload matched routes sequentially

* add changeset
  • Loading branch information
lilnasy authored Feb 14, 2024
1 parent 51b6ff7 commit 4bcc249
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/afraid-seals-tan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"astro": patch
---

Fixes an issue where the dev server froze when typescript aliases were used.
15 changes: 7 additions & 8 deletions packages/astro/src/prerender/routing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand All @@ -64,9 +64,8 @@ async function preloadAndSetPrerenderStatus({
route.prerender = prerenderStatus;
}

return { preloadedComponent, route, filePath };
})
);
preloaded.push({ preloadedComponent, route, filePath });
}
return preloaded;
}

Expand Down

0 comments on commit 4bcc249

Please sign in to comment.