Skip to content

Commit

Permalink
Skip prerender chunk in static output (#10695)
Browse files Browse the repository at this point in the history
  • Loading branch information
bluwy committed Apr 8, 2024
1 parent ecb4435 commit a15975e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/plenty-bugs-hunt.md
@@ -0,0 +1,5 @@
---
"astro": patch
---

Skips prerender chunk if building with static output
6 changes: 5 additions & 1 deletion packages/astro/src/core/build/plugins/plugin-prerender.ts
Expand Up @@ -68,7 +68,6 @@ function vitePluginPrerender(opts: StaticBuildOptions, internals: BuildInternals
}
}

opts.allPages;
pageInfo.hasSharedModules = hasSharedModules;
pageInfo.route.prerender = true;
return 'prerender';
Expand All @@ -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: {
Expand Down

0 comments on commit a15975e

Please sign in to comment.