diff --git a/.changeset/plenty-bugs-hunt.md b/.changeset/plenty-bugs-hunt.md new file mode 100644 index 000000000000..179310ea97b0 --- /dev/null +++ b/.changeset/plenty-bugs-hunt.md @@ -0,0 +1,5 @@ +--- +"astro": patch +--- + +Skips prerender chunk if building with static output diff --git a/packages/astro/src/core/build/plugins/plugin-prerender.ts b/packages/astro/src/core/build/plugins/plugin-prerender.ts index ce9f925ee339..171d998b7b9b 100644 --- a/packages/astro/src/core/build/plugins/plugin-prerender.ts +++ b/packages/astro/src/core/build/plugins/plugin-prerender.ts @@ -68,7 +68,6 @@ function vitePluginPrerender(opts: StaticBuildOptions, internals: BuildInternals } } - opts.allPages; pageInfo.hasSharedModules = hasSharedModules; pageInfo.route.prerender = true; return 'prerender'; @@ -87,6 +86,11 @@ export function pluginPrerender( opts: StaticBuildOptions, internals: BuildInternals ): AstroBuildPlugin { + // Static output can skip prerender completely because we're already rendering all pages + if (opts.settings.config.output === 'static') { + return { targets: ['server'] }; + } + return { targets: ['server'], hooks: {