Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip prerender chunk in static output #10695

Merged
merged 1 commit into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/plenty-bugs-hunt.md
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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