fix(astro): server islands not working in prerendered pages with server output#15767
Merged
fix(astro): server islands not working in prerendered pages with server output#15767
Conversation
🦋 Changeset detectedLatest commit: 67d9150 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
When server islands (server:defer) are only used in prerendered pages, the SSR build environment never discovers them — it leaves empty map placeholders in the manifest. The prerender build discovers the islands later but the SSR output is already finalized. Fix by deferring placeholder replacement during build: renderChunk leaves placeholders intact when no islands are known yet, renderChunk saves resolved filenames when processing them in the prerender env, and generateBundle patches the SSR manifest chunk in-memory. A post-build hook also patches the on-disk SSR output and copies island component chunks from the prerender directory to the server output.
commit: |
Member
|
This fixed it for my site! |
Princesseuh
approved these changes
Mar 11, 2026
Merged
1 task
dadezzz
pushed a commit
to dadezzz/ice-notes
that referenced
this pull request
Mar 17, 2026
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [astro](https://astro.build) ([source](https://github.com/withastro/astro/tree/HEAD/packages/astro)) | [`6.0.3` → `6.0.4`](https://renovatebot.com/diffs/npm/astro/6.0.3/6.0.4) |  |  | --- ### Release Notes <details> <summary>withastro/astro (astro)</summary> ### [`v6.0.4`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#604) [Compare Source](https://github.com/withastro/astro/compare/astro@6.0.3...astro@6.0.4) ##### Patch Changes - [#​15870](withastro/astro#15870) [`920f10b`](withastro/astro@920f10b) Thanks [@​matthewp](https://github.com/matthewp)! - Prebundle `astro/toolbar` in dev when custom dev toolbar apps are registered, preventing re-optimization reloads that can hide or break the toolbar. - [#​15876](withastro/astro#15876) [`f47ac53`](withastro/astro@f47ac53) Thanks [@​ematipico](https://github.com/ematipico)! - Fixes `redirectToDefaultLocale` producing a protocol-relative URL (`//locale`) instead of an absolute path (`/locale`) when `base` is `'/'`. - [#​15767](withastro/astro#15767) [`e0042f7`](withastro/astro@e0042f7) Thanks [@​matthewp](https://github.com/matthewp)! - Fixes server islands (`server:defer`) not working when only used in prerendered pages with `output: 'server'`. - [#​15873](withastro/astro#15873) [`35841ed`](withastro/astro@35841ed) Thanks [@​matthewp](https://github.com/matthewp)! - Fix a dev server bug where newly created pages could miss layout-imported CSS until restart. - [#​15874](withastro/astro#15874) [`ce0669d`](withastro/astro@ce0669d) Thanks [@​ematipico](https://github.com/ematipico)! - Fixes a warning when using `prefetchAll` - [#​15754](withastro/astro#15754) [`58f1d63`](withastro/astro@58f1d63) Thanks [@​rururux](https://github.com/rururux)! - Fixes a bug where a directory at the project root sharing the same name as a page route would cause the dev server to return a 404 instead of serving the page. - [#​15869](withastro/astro#15869) [`76b3a5e`](withastro/astro@76b3a5e) Thanks [@​matthewp](https://github.com/matthewp)! - Update the unknown file extension error hint to recommend `vite.resolve.noExternal`, which is the correct Vite 7 config key. </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My41OS41IiwidXBkYXRlZEluVmVyIjoiNDMuNTkuNSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==--> Co-authored-by: Renovate Bot <renovate@zarantonello.dev> Co-committed-by: Renovate Bot <renovate@zarantonello.dev>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Testing
test/units/build/server-islands.test.jsthat runs an in-memory Astro build using virtual.astromodules (no fixture files on disk).server:deferis only used in prerendered pages.Docs
N/A, bug fix