Fix order-of-execution bug when generating pages (#5822)

* fix: bundle all pages into a single chunk

* chore: add changeset

Co-authored-by: Nate Moore <nate@astro.build>
This commit is contained in:
Nate Moore 2023-01-11 09:51:50 -05:00 committed by GitHub
parent 23dc9ea96a
commit 01f3f463bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Fix edge case with bundle generation by emitting a single chunk for pages

View file

@ -34,8 +34,8 @@ export function vitePluginPrerender(
if (api.getModuleInfo(id)?.meta.astro?.pageOptions?.prerender) {
return `prerender`;
}
// pages should go in their own chunks/pages/* directory
return `pages${pageInfo.route.route.replace(/\/$/, '/index')}`;
// dynamic pages should all go in their own chunk in the pages/* directory
return `pages/all`;
}
};
},