From e29e9591d071a4c706305dcce2ead9cacfe6716e Mon Sep 17 00:00:00 2001 From: Rihan Arfan Date: Sun, 25 Jan 2026 20:47:26 +0000 Subject: [PATCH 1/3] docs(cloudflare): remove invalid docs and add note about wrangler environments --- docs/2.deploy/20.providers/cloudflare.md | 29 ++++++++---------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/docs/2.deploy/20.providers/cloudflare.md b/docs/2.deploy/20.providers/cloudflare.md index cf99290636..d2f1d00bd5 100644 --- a/docs/2.deploy/20.providers/cloudflare.md +++ b/docs/2.deploy/20.providers/cloudflare.md @@ -311,32 +311,21 @@ id = "xxx" :: -Or in your Nitro config: +If you have multiple Wrangler environments, you can specify which Wrangler environment to use during Cloudflare dev emulation: - -```js [nitro.config.js] -import { defineNitroConfig } from "nitro/config"; - -export default defineNitroConfig({ +```ts [nuxt.config.ts] +export default defineNuxtConfig({ + nitro: { + preset: 'cloudflare-module', cloudflare: { - wrangler: { - vars: { - MY_VARIABLE: "my-value" - }, - kv_namespaces: [ - { - binding: "MY_KV", - id: "xxx" - } - ] + dev: { + environment: 'preview' } } -}); + }, +}) ``` -> [!NOTE] -> Only bindings in the default environment are recognized. - Next we install the required `wrangler` package (if not already installed): :pm-install{name="wrangler -D"} From 015046eb44359387f982064ab5398ebff75d1712 Mon Sep 17 00:00:00 2001 From: Rihan Arfan Date: Sun, 25 Jan 2026 21:07:21 +0000 Subject: [PATCH 2/3] docs: defineNitroConfig --- docs/2.deploy/20.providers/cloudflare.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/2.deploy/20.providers/cloudflare.md b/docs/2.deploy/20.providers/cloudflare.md index d2f1d00bd5..cd6cdf8094 100644 --- a/docs/2.deploy/20.providers/cloudflare.md +++ b/docs/2.deploy/20.providers/cloudflare.md @@ -313,16 +313,16 @@ id = "xxx" If you have multiple Wrangler environments, you can specify which Wrangler environment to use during Cloudflare dev emulation: -```ts [nuxt.config.ts] -export default defineNuxtConfig({ - nitro: { - preset: 'cloudflare-module', - cloudflare: { - dev: { - environment: 'preview' - } +```ts [nitro.config.ts] +import { defineNitroConfig } from "nitro/config"; + +export default defineNitroConfig({ + preset: 'cloudflare-module', + cloudflare: { + dev: { + environment: 'preview' } - }, + } }) ``` From bd5d54492a3d6037c11d0e76eeb2bf3b98a7a420 Mon Sep 17 00:00:00 2001 From: Rihan Arfan Date: Sun, 25 Jan 2026 21:16:48 +0000 Subject: [PATCH 3/3] improve structure --- docs/2.deploy/20.providers/cloudflare.md | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/docs/2.deploy/20.providers/cloudflare.md b/docs/2.deploy/20.providers/cloudflare.md index cd6cdf8094..972983f3ce 100644 --- a/docs/2.deploy/20.providers/cloudflare.md +++ b/docs/2.deploy/20.providers/cloudflare.md @@ -280,7 +280,7 @@ defineHandler(async (event) => { ### Access to the bindings in local dev -To access bindings in dev mode, we first define them. You can do this in a `wrangler.toml`/`wrangler.json` file, or directly in your Nitro config under `cloudflare.wrangler` (accepts the same type as `wrangler.json`). +To access bindings in dev mode, we first define them. You can do this in a `wrangler.jsonc`/`wrangler.json`/`wrangler.toml` file For example, to define a variable and a KV namespace in `wrangler.toml`: @@ -311,6 +311,18 @@ id = "xxx" :: +Next we install the required `wrangler` package (if not already installed): + +:pm-install{name="wrangler -D"} + +From this moment, when running + +:pm-run{script="dev"} + +you will be able to access the `MY_VARIABLE` and `MY_KV` from the request event just as illustrated above. + +#### Wrangler environments + If you have multiple Wrangler environments, you can specify which Wrangler environment to use during Cloudflare dev emulation: ```ts [nitro.config.ts] @@ -325,13 +337,3 @@ export default defineNitroConfig({ } }) ``` - -Next we install the required `wrangler` package (if not already installed): - -:pm-install{name="wrangler -D"} - -From this moment, when running - -:pm-run{script="dev"} - -you will be able to access the `MY_VARIABLE` and `MY_KV` from the request event just as illustrated above.