Skip to content
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

Update cloudflare.mdx #6150

Merged
merged 5 commits into from
Jan 9, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion src/content/docs/en/guides/integrations-guide/cloudflare.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,30 @@ export default defineConfig({

### `imageService`

`imageService: "passthrough" | "cloudflare"`
`imageService: "passthrough" | "cloudflare" | "compile"`

Determines which image service is used by the adapter. The adapter will default to `passthrough` mode when an incompatible image service is configured. Otherwise, it will use the globally configured image service:

* **`cloudflare`:** Uses the [Cloudflare Image Resizing](https://developers.cloudflare.com/images/image-resizing/) service.
* **`passthrough`:** Uses the existing [`noop`](/en/guides/images/#configure-no-op-passthrough-service) service.
* **`compile`:** Uses Astro's default service (sharp) to optimize images during build.
alexanderniebuhr marked this conversation as resolved.
Show resolved Hide resolved

```js title="astro.config.mjs" ins={6}
import {defineConfig} from "astro/config";
import cloudflare from '@astrojs/cloudflare';

export default defineConfig({
adapter: cloudflare({
imageService: 'cloudflare'
}),
output: 'server'
})
```

:::caution
While the option `compile`, allows you to optimize Images using sharp, during build, it disables any support for image optimization during SSR. You need to make sure that you don't use any Image features in SSR routes (e.g. `<Image />`, `<Picture />`, `getImage()`.
That means all images to be optimized need to be placed on routes which are pre-rendered.
:::

### `wasmModuleImports`

Expand Down
Loading