diff --git a/.changeset/red-houses-explode.md b/.changeset/red-houses-explode.md new file mode 100644 index 000000000000..d355327f34a6 --- /dev/null +++ b/.changeset/red-houses-explode.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fixes the regression which broke bundling of image service for pre-rendered pages, which was introduced by [#8854](https://github.com/withastro/astro/pull/8854) diff --git a/packages/astro/src/core/build/plugins/plugin-prerender.ts b/packages/astro/src/core/build/plugins/plugin-prerender.ts index d3d5305e4f43..0584f15a6b59 100644 --- a/packages/astro/src/core/build/plugins/plugin-prerender.ts +++ b/packages/astro/src/core/build/plugins/plugin-prerender.ts @@ -12,7 +12,11 @@ function vitePluginPrerender(opts: StaticBuildOptions, internals: BuildInternals outputOptions(outputOptions) { extendManualChunks(outputOptions, { - before(id, meta) { + after(id, meta) { + // Split the Astro runtime into a separate chunk for readability + if (id.includes('astro/dist/runtime')) { + return 'astro'; + } const pageInfo = internals.pagesByViteID.get(id); if (pageInfo) { // prerendered pages should be split into their own chunk