-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Document Cloudflare binding build-time image optimization #13848
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
Changes from 2 commits
06e5f1a
65a0e1a
651a5eb
de5a5e8
357c637
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -116,7 +116,7 @@ It also accepts the following: | |
| ### `imageService` | ||
|
|
||
| <p> | ||
| **Type:** `'passthrough' | 'cloudflare' | 'cloudflare-binding' | 'compile' | 'custom' | { build: 'compile', runtime?: 'cloudflare-binding' | 'passthrough' }`<br /> | ||
| **Type:** `'passthrough' | 'cloudflare' | 'cloudflare-binding' | 'compile' | 'custom' | { build: 'compile', runtime?: 'cloudflare-binding' | 'passthrough' } | { build: 'cloudflare-binding', runtime?: 'cloudflare-binding' | 'passthrough' }`<br /> | ||
| **Default:** `'cloudflare-binding'` | ||
| </p> | ||
|
|
||
|
|
@@ -128,7 +128,7 @@ Determines which image service is used by the adapter. The adapter will default | |
| - **`compile`:** Uses the [configured image service](/en/reference/configuration-reference/#imageservice) or falls back to 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`:** Uses the [configured image service](/en/reference/configuration-reference/#imageservice) (defaults to Sharp) to process assets at build time for prerendered routes. Bundles the image service for runtime image handling, without checking its compatibility with 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'`: | ||
|
alexanderniebuhr marked this conversation as resolved.
Outdated
|
||
|
|
||
| ```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. | ||
|
alexanderniebuhr marked this conversation as resolved.
Outdated
|
||
|
|
||
| ```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' } | ||
|
alexanderniebuhr marked this conversation as resolved.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I noticed we still show
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think even if it is the default value, we should still be able to configure it. Maybe the code PR needs an update here. |
||
| }), | ||
| }); | ||
| ``` | ||
|
|
||
| ### `sessionKVBindingName` | ||
|
|
||
| <p> | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.