Skip to content

Commit 3db1cab

Browse files
committed
update local images binding docs with vite support
1 parent d3581f1 commit 3db1cab

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

src/content/docs/images/transform-images/bindings.mdx

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,18 +114,33 @@ Wrangler supports two different versions of the Images API:
114114

115115
To test the high-fidelity version of Images, you can run `wrangler dev`:
116116

117-
```txt
117+
```sh
118118
npx wrangler dev
119119
```
120120

121121
This creates a local-only environment that mirrors the production environment where Cloudflare runs the Images API. You can test your Worker with all available transformation features before deploying to production.
122122

123-
To test the low-fidelity offline version of Images, add the `--experimental-images-local-mode` flag:
123+
To test the low-fidelity offline version of Images, add the `--experimental-images-local-mode` flag when running `wrangler dev`:
124124

125-
```txt
125+
```sh
126126
npx wrangler dev --experimental-images-local-mode
127127
```
128128

129+
Or, set the `imagesLocalMode` experimental option to `true` in your Vite config if you are using the Cloudflare Vite plugin:
130+
131+
```ts
132+
import { cloudflare } from "@cloudflare/vite-plugin";
133+
import { defineConfig } from "vite";
134+
135+
export default defineConfig({
136+
plugins: [
137+
cloudflare({
138+
experimental: { imagesLocalMode: true },
139+
}),
140+
],
141+
});
142+
```
143+
129144
Currently, this version supports only `width`, `height`, `rotate`, and `format`.
130145

131146
When testing with the [Workers Vitest integration](/workers/testing/vitest-integration/), the low-fidelity offline version is used by default, to avoid hitting the Cloudflare API in tests.

0 commit comments

Comments
 (0)