0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-01-27 22:19:04 -05:00

Skip prerender chunk in static output (#10695)

This commit is contained in:
Bjorn Lu 2024-04-08 13:33:09 +08:00 committed by GitHub
parent ecb44351e9
commit a15975e41c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
"astro": patch
---
Skips prerender chunk if building with static output

View file

@ -68,7 +68,6 @@ function vitePluginPrerender(opts: StaticBuildOptions, internals: BuildInternals
} }
} }
opts.allPages;
pageInfo.hasSharedModules = hasSharedModules; pageInfo.hasSharedModules = hasSharedModules;
pageInfo.route.prerender = true; pageInfo.route.prerender = true;
return 'prerender'; return 'prerender';
@ -87,6 +86,11 @@ export function pluginPrerender(
opts: StaticBuildOptions, opts: StaticBuildOptions,
internals: BuildInternals internals: BuildInternals
): AstroBuildPlugin { ): AstroBuildPlugin {
// Static output can skip prerender completely because we're already rendering all pages
if (opts.settings.config.output === 'static') {
return { targets: ['server'] };
}
return { return {
targets: ['server'], targets: ['server'],
hooks: { hooks: {