diff --git a/src/content/docs/en/guides/integrations-guide/cloudflare.mdx b/src/content/docs/en/guides/integrations-guide/cloudflare.mdx index e663d1a1971aa..cb5658fd7412a 100644 --- a/src/content/docs/en/guides/integrations-guide/cloudflare.mdx +++ b/src/content/docs/en/guides/integrations-guide/cloudflare.mdx @@ -116,7 +116,7 @@ It also accepts the following: ### `imageService`

-**Type:** `'passthrough' | 'cloudflare' | 'cloudflare-binding' | 'compile' | 'custom' | { build: 'compile', runtime?: 'cloudflare-binding' | 'passthrough' }`
+**Type:** `'passthrough' | 'cloudflare' | 'cloudflare-binding' | 'compile' | 'custom' | { build: 'compile', runtime?: 'cloudflare-binding' | 'passthrough' } | { build: 'cloudflare-binding', runtime?: 'cloudflare-binding' | 'passthrough' }`
**Default:** `'cloudflare-binding'`

@@ -128,7 +128,7 @@ Determines which image service is used by the adapter. The adapter will default - **`compile`:** Uses a combination of internal dependencies to transform images locally at build time for prerendered routes. The noop `passthrough` option is configured for on-demand rendered pages. - **`custom`:** Always uses the image service configured in [Image Options](/en/reference/configuration-reference/#image-options). **This option will not check to see whether the configured image service works in Cloudflare's `workerd` runtime.** -It is also possible to configure your image service as an object, setting both a build time and runtime service independently. Currently, `'compile'` is the only available build-time option. The supported runtime options are `'passthrough'` (default) and `'cloudflare-binding'`: +It is also possible to configure your image service as an object, setting both a build time and runtime service independently. The supported build-time options are `'compile'` and `'cloudflare-binding'`. The supported runtime options are `'passthrough'` (default) and `'cloudflare-binding'`: ```js title="astro.config.mjs" ins={6} import { defineConfig } from 'astro/config'; @@ -141,6 +141,19 @@ export default defineConfig({ }); ``` +To opt in to build-time image optimization with the Cloudflare Images binding during `workerd` prerendering, set `build` to `'cloudflare-binding'`. The default string shorthand, `imageService: 'cloudflare-binding'`, keeps the existing runtime-only behavior. + +```js title="astro.config.mjs" ins={6} +import { defineConfig } from 'astro/config'; +import cloudflare from '@astrojs/cloudflare'; + +export default defineConfig({ + adapter: cloudflare({ + imageService: { build: 'cloudflare-binding', runtime: 'cloudflare-binding' } + }), +}); +``` + ### `sessionKVBindingName`