Skip to content

Include injected routes when checking if renderers are needed in SSR builds#16178

Merged
matthewp merged 1 commit intomainfrom
ssr-renderers-injected-routes-only
Apr 1, 2026
Merged

Include injected routes when checking if renderers are needed in SSR builds#16178
matthewp merged 1 commit intomainfrom
ssr-renderers-injected-routes-only

Conversation

@matthewp
Copy link
Copy Markdown
Contributor

@matthewp matthewp commented Apr 1, 2026

Changes

  • SSR builds with only injected routes (no src/pages/ directory) were failing at runtime with No matching renderer found.
  • The renderer plugin's build optimization strips renderers from the SSR bundle when it determines no SSR pages need them. The way it determines this was not accounting for injected routes. This fixes it.

Testing

  • Added unit tests for hasNonPrerenderedRoute covering: project pages, prerendered pages, endpoint exclusion, and the new includeExternal option with injected routes.
  • Verified end-to-end against HiDeoo's reproduction

Docs

  • N/A, bug fix

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Apr 1, 2026
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Apr 1, 2026

Merging this PR will not alter performance

✅ 18 untouched benchmarks


Comparing ssr-renderers-injected-routes-only (fb6850e) with main (4eec0f1)

Open in CodSpeed

@matthewp matthewp marked this pull request as ready for review April 1, 2026 13:15
@matthewp matthewp merged commit a7e7567 into main Apr 1, 2026
26 checks passed
@matthewp matthewp deleted the ssr-renderers-injected-routes-only branch April 1, 2026 15:08
@astrobot-houston astrobot-houston mentioned this pull request Apr 1, 2026
dadezzz pushed a commit to dadezzz/ice-notes that referenced this pull request Apr 5, 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.1.1` → `6.1.3`](https://renovatebot.com/diffs/npm/astro/6.1.1/6.1.3) | ![age](https://developer.mend.io/api/mc/badges/age/npm/astro/6.1.3?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/astro/6.1.1/6.1.3?slim=true) |

---

### Release Notes

<details>
<summary>withastro/astro (astro)</summary>

### [`v6.1.3`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#613)

[Compare Source](https://github.com/withastro/astro/compare/astro@6.1.2...astro@6.1.3)

##### Patch Changes

- [#&#8203;16161](withastro/astro#16161) [`b51f297`](withastro/astro@b51f297) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes a dev rendering issue with the Cloudflare adapter where head metadata could be missing and dev CSS/scripts could be injected in the wrong place

- [#&#8203;16110](withastro/astro#16110) [`de669f0`](withastro/astro@de669f0) Thanks [@&#8203;tmimmanuel](https://github.com/tmimmanuel)! - Fixes skew protection query parameters not being appended to inter-chunk JavaScript imports in client bundles, which could cause version mismatches during rolling deployments on Vercel

- [#&#8203;16162](withastro/astro#16162) [`a0a49e9`](withastro/astro@a0a49e9) Thanks [@&#8203;rururux](https://github.com/rururux)! - Fixes an issue where HMR would not trigger when modifying files while using [@&#8203;astrojs/cloudflare](https://github.com/astrojs/cloudflare) with prerenderEnvironment: 'node' enabled.

- [#&#8203;16142](withastro/astro#16142) [`7454854`](withastro/astro@7454854) Thanks [@&#8203;rururux](https://github.com/rururux)! - Fixes HTML content being incorrectly escaped as plain text when rendering a MDX component using the `AstroContainer` APIs.

- [#&#8203;16116](withastro/astro#16116) [`12602a9`](withastro/astro@12602a9) Thanks [@&#8203;riderx](https://github.com/riderx)! - Fixes a bug where page-level CSS could leak between unrelated pages when traversing style parents across top-level route boundaries

- [#&#8203;16178](withastro/astro#16178) [`a7e7567`](withastro/astro@a7e7567) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes SSR builds failing with "No matching renderer found" when a project only has injected routes and no `src/pages/` directory

### [`v6.1.2`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#612)

[Compare Source](https://github.com/withastro/astro/compare/astro@6.1.1...astro@6.1.2)

##### Patch Changes

- [#&#8203;16104](withastro/astro#16104) [`47a394d`](withastro/astro@47a394d) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes `astro preview` ignoring `vite.preview.allowedHosts` set in `astro.config.mjs`

- [#&#8203;16047](withastro/astro#16047) [`711f837`](withastro/astro@711f837) Thanks [@&#8203;matthewp](https://github.com/matthewp)! - Fixes catch-all routes incorrectly intercepting requests for static assets when using the `@astrojs/node` adapter in middleware mode.

- [#&#8203;15981](withastro/astro#15981) [`a60cbb6`](withastro/astro@a60cbb6) Thanks [@&#8203;moktamd](https://github.com/moktamd)! - Fix Zod v4 validation error formatting to show human-readable messages instead of raw JSON

</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:eyJjcmVhdGVkSW5WZXIiOiI0My45OS4xIiwidXBkYXRlZEluVmVyIjoiNDMuOTkuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->

Co-authored-by: Renovate Bot <renovate@zarantonello.dev>
Co-committed-by: Renovate Bot <renovate@zarantonello.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: astro Related to the core `astro` package (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants