Skip SSR build for fully static Cloudflare sites#16468
Merged
Merged
Conversation
- Cloudflare adapter now passes through buildOutput from core instead of hardcoding 'server', allowing static sites to skip the SSR environment build. - Server islands plugin upgrades buildOutput from 'static' to 'server' when server:defer components are discovered during prerendering.
🦋 Changeset detectedLatest commit: 2bc1e7f The changes in this PR will be included in the next version bump. This PR includes changesets to release 403 packages
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 |
Adds minimumReleaseAge exclusions for transitive Cloudflare deps.
Contributor
|
| 📦 Package | 📏 Size |
|---|---|
| @cloudflare/workerd-linux-64@1.20260526.1 | 125.1 MB |
| miniflare@4.20260526.0 | 19.4 MB |
| wrangler@4.95.0 | 16.7 MB |
| workerd@1.20260526.1 | 4.8 MB |
| @cloudflare/vite-plugin@1.32.3 → @cloudflare/vite-plugin@1.39.0 | 2.9 MB |
| rosie-skills-linux-x64@0.6.4 | 2.7 MB |
| rosie-skills@0.6.4 | 491.6 kB |
| @cloudflare/kv-asset-handler@0.5.0 | 182.5 kB |
| ws@8.20.1 | 148.7 kB |
| @cloudflare/unenv-preset@2.16.1 | 31.6 kB |
Total size change: 172.5 MB
Move server islands buildOutput upgrade from the vite plugin transform (which runs mid-prerender-build) to static-build.ts (after prerender completes). This avoids a directory path mismatch where the prerender output is written to the static path but manifest injection writes to the server path.
…rerender - Expose hasServerIslands() on server islands plugin API - After prerender build, upgrade buildOutput to 'server' if server islands were discovered (so SSR build, manifest injection, and runtime all use correct server paths) - Capture prerenderOutputDir before mutation to avoid path mismatch - Simplify writeMutatedChunks to use getServerOutputDirectory - Update session wrangler config test for static build output path
- Add preserveBuildServerDir adapter feature so adapters can control the server output directory for static builds (mirrors preserveBuildClientDir) - Cloudflare adapter sets preserveBuildServerDir: true - Extract hasServerIslands() from server islands plugin as a standalone exported function that accepts any BuildEnvironment - Replace buildOutput mutation in static-build.ts with a needsServerBuild() helper that checks settings.buildOutput or hasServerIslands()
- Stop overwriting buildOutput after route scanning in preview command; let route scanning upgrade it from 'static' to 'server' when needed - Skip static preview server when adapter provides a previewEntrypoint - Use getClientOutputDirectory in static preview server to respect preserveBuildClientDir - Exempt internal routes (e.g. server islands) from getStaticPaths requirement and static path matching
Switch to @cloudflare/vite-plugin PR #13985 which adds a devOnly property. Set devOnly to a function that returns true when buildOutput is 'static', letting the CF plugin skip the SSR worker build and emit an assets-only wrangler config for fully static sites.
Princesseuh
approved these changes
May 27, 2026
ematipico
approved these changes
May 27, 2026
Co-authored-by: Emanuele Stoppa <estoppa@cloudflare.com>
ArmandPhilippot
approved these changes
May 27, 2026
ArmandPhilippot
left a comment
Member
There was a problem hiding this comment.
A nit for the Cloudflare changeset, otherwise LGTM docs-wise!
Co-authored-by: Armand Philippot <git@armand.philippot.eu>
# Conflicts: # pnpm-workspace.yaml
…astro into cloudflare-static-buildoutput
Merged
dadezzz
pushed a commit
to dadezzz/university_notes
that referenced
this pull request
Jun 1, 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.3.8` → `6.4.2`](https://renovatebot.com/diffs/npm/astro/6.3.8/6.4.2) |  |  | --- ### Release Notes <details> <summary>withastro/astro (astro)</summary> ### [`v6.4.2`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#642) ##### Patch Changes - [#​16889](withastro/astro#16889) [`b94bcfd`](withastro/astro@b94bcfd) Thanks [@​Princesseuh](https://github.com/Princesseuh)! - Fixes a `plugins is not iterable` crash when using a pre-6.0 `@astrojs/mdx` alongside integrations (e.g. Starlight) that set `markdown.remarkPlugins`, `markdown.rehypePlugins`, or `markdown.remarkRehype`. - [#​16878](withastro/astro#16878) [`b9f6bb9`](withastro/astro@b9f6bb9) Thanks [@​fkatsuhiro](https://github.com/fkatsuhiro)! - Fixes an issue where on-demand (SSR) dynamic routes would return 404 when a prerendered dynamic route with the same URL pattern was sorted first alphabetically. In production builds with `@astrojs/node` adapter, if `[a_prebuild].astro` (prerender=true) came before `[b_ssr].astro` alphabetically, requests to URLs not in the prerendered route's static paths would 404 instead of falling through to the SSR route. The fix adds fallthrough logic so that when a prerendered dynamic route matches but can't serve the request, Astro tries subsequent matching routes. ### [`v6.4.1`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#641) ##### Patch Changes - [#​16883](withastro/astro#16883) [`eeb064c`](withastro/astro@eeb064c) Thanks [@​Princesseuh](https://github.com/Princesseuh)! - Restores the `astro/jsx/rehype.js` entry point so that older versions of `@astrojs/mdx` continue to work when used with Astro 6.x. This entry point will be removed in Astro 7.0. ### [`v6.4.0`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#640) [Compare Source](https://github.com/withastro/astro/compare/astro@6.3.8...astro@6.4.0) ##### Minor Changes - [#​16468](withastro/astro#16468) [`4cff3a1`](withastro/astro@4cff3a1) Thanks [@​matthewp](https://github.com/matthewp)! - Adds a new `preserveBuildServerDir` adapter feature Adapters can now set `preserveBuildServerDir: true` in their adapter features to keep the `dist/server/` directory structure for static builds, mirroring the existing `preserveBuildClientDir` option. This is useful for adapters that require a consistent `dist/client/` and `dist/server/` layout regardless of build output type. ```js setAdapter({ name: 'my-adapter', adapterFeatures: { buildOutput, preserveBuildClientDir: true, preserveBuildServerDir: true, }, }); ``` - [#​16848](withastro/astro#16848) [`f732f3c`](withastro/astro@f732f3c) Thanks [@​Princesseuh](https://github.com/Princesseuh)! - Adds a new `markdown.processor` configuration option, allowing you to choose an alternative Markdown processor. Websites with many Markdown/MDX files tend to be slow to build because the unified ecosystem (e.g., remark, rehype) is slow to process. This feature introduces the ability to replace this part of the build pipeline with another processor. The default processor is `unified()`. This means that existing configurations remain unchanged and your remark/rehype plugins continue to work. ```js // astro.config.mjs import { defineConfig } from 'astro/config'; import { unified } from '@​astrojs/markdown-remark'; import remarkToc from 'remark-toc'; export default defineConfig({ markdown: { processor: unified({ remarkPlugins: [remarkToc], }), }, }); ``` In addition to this new configuration option, Astro provides a new alternative processor based on Rust: [Sätteri](https://satteri.bruits.org/). You can choose to use it now by installing `@astrojs/markdown-satteri`, importing the `satteri()` processor, and adapting your existing configuration: ```js // astro.config.mjs import { defineConfig } from 'astro/config'; import { satteri } from '@​astrojs/markdown-satteri'; export default defineConfig({ markdown: { processor: satteri({ features: { directive: true }, }), }, }); ``` This processor does not support the remark and rehype plugins. This means you may need to convert them to [MDAST or HAST plugins](https://satteri.bruits.org/docs/plugins/) to retain your current functionality. The existing top-level `markdown.remarkPlugins`, `markdown.rehypePlugins`, `markdown.remarkRehype`, `markdown.gfm`, and `markdown.smartypants` options still work, but are now deprecated and will be removed in a future major update. The matching `remarkPlugins`, `rehypePlugins`, and `remarkRehype` options on the MDX integration are also deprecated for the same reason. To anticipate their removal, move them onto `unified({...})` (or your preferred plugin processor) : ```diff // astro.config.mjs import { defineConfig } from 'astro/config'; import remarkToc from 'remark-toc'; import rehypeSlug from 'rehype-slug'; + import { unified } from '@​astrojs/markdown-remark'; export default defineConfig({ markdown: { + processor: unified({ + remarkPlugins: [remarkToc], + rehypePlugins: [rehypeSlug], + remarkRehype: true, + gfm: true, + smartypants: true, + }), - remarkPlugins: [remarkToc], - rehypePlugins: [rehypeSlug], - remarkRehype: true, - gfm: true, - smartypants: true, }, }); ``` For more information on enabling and using this feature in your project, see our [Markdown guide](https://docs.astro.build/en/guides/markdown-content/). To give feedback on this new Rust processor, see the [Native Markdown / MDX parsing and processing RFC](withastro/roadmap#1364). ##### Patch Changes - [#​16468](withastro/astro#16468) [`4cff3a1`](withastro/astro@4cff3a1) Thanks [@​matthewp](https://github.com/matthewp)! - Skips the static preview server when an adapter provides its own `previewEntrypoint`, allowing the adapter to handle both static and dynamic routes - [#​16811](withastro/astro#16811) [`e0e26db`](withastro/astro@e0e26db) Thanks [@​matthewp](https://github.com/matthewp)! - Fixes `X-Forwarded-Host` and `X-Forwarded-Proto` headers being ignored when set in a custom `src/app.ts` fetch handler before creating `FetchState` - [#​16468](withastro/astro#16468) [`4cff3a1`](withastro/astro@4cff3a1) Thanks [@​matthewp](https://github.com/matthewp)! - Fixes the static preview server to respect `preserveBuildClientDir`, serving files from `build.client` instead of `outDir` when the adapter requires it - [#​16770](withastro/astro#16770) [`1e2aa11`](withastro/astro@1e2aa11) Thanks [@​matthewp](https://github.com/matthewp)! - Fixes a race condition where the Vite dep optimizer could lose React dependencies in dev mode when using Astro Actions - [#​16468](withastro/astro#16468) [`4cff3a1`](withastro/astro@4cff3a1) Thanks [@​matthewp](https://github.com/matthewp)! - Exempts internal routes (e.g. server islands) from `getStaticPaths()` validation, fixing server island rendering on static sites - [#​16468](withastro/astro#16468) [`4cff3a1`](withastro/astro@4cff3a1) Thanks [@​matthewp](https://github.com/matthewp)! - Fixes preview for static sites that contain non-prerendered routes. Previously, the preview command ignored SSR routes discovered during route scanning and always used the static preview server. - Updated dependencies \[[`f732f3c`](withastro/astro@f732f3c), [`f732f3c`](withastro/astro@f732f3c)]: - [@​astrojs/internal-helpers](https://github.com/astrojs/internal-helpers)@​0.10.0 - [@​astrojs/markdown-remark](https://github.com/astrojs/markdown-remark)@​7.2.0 </details> --- ### Configuration 📅 **Schedule**: (UTC) - 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 [Mend Renovate](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yMDQuMSIsInVwZGF0ZWRJblZlciI6IjQzLjIwNS4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
1 task
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.
Currently all Cloudflare projects get build as server apps. The new version of the Cloudflare Vite plugin adds an
assetsOnlyto allow using the plugin for static-only builds. This implements that. We need a newpreserveBuildServerDirfeature to prevent building the static site straight todist/, we still need thedist/server/distinction for this build even though only assets are deployed.Changes
buildOutputfrom core instead of hardcoding'server', so fully static sites skip the SSR environment build entirely.assetsOnlyoption in@cloudflare/vite-pluginv1.39.0 to signal when a build is static-only.buildOutputto'server'whenserver:deferis discovered during prerendering, so the SSR build still runs when needed.preserveBuildServerDiradapter feature to keepdist/server/anddist/client/layout for all build types.Testing
Docs
preserveBuildServerDiradapter feature. Will follow up separately.