From 01f3f463bf2918b310d130a9fabbf3ee21d14029 Mon Sep 17 00:00:00 2001 From: Nate Moore Date: Wed, 11 Jan 2023 09:51:50 -0500 Subject: [PATCH] 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 --- .changeset/beige-beds-smile.md | 5 +++++ packages/astro/src/core/build/vite-plugin-prerender.ts | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/beige-beds-smile.md diff --git a/.changeset/beige-beds-smile.md b/.changeset/beige-beds-smile.md new file mode 100644 index 000000000..ee0f23a7c --- /dev/null +++ b/.changeset/beige-beds-smile.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fix edge case with bundle generation by emitting a single chunk for pages diff --git a/packages/astro/src/core/build/vite-plugin-prerender.ts b/packages/astro/src/core/build/vite-plugin-prerender.ts index b8091c32d..fdc505378 100644 --- a/packages/astro/src/core/build/vite-plugin-prerender.ts +++ b/packages/astro/src/core/build/vite-plugin-prerender.ts @@ -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`; } }; },