nuxt.com icon indicating copy to clipboard operation
nuxt.com copied to clipboard

docs: add cloudflare workers section

Open Hebilicious opened this issue 10 months ago โ€ข 5 comments

Cloudflare Workers is going to be in the future the main way to deploy application on Cloudflare, presenting it first makes sense. This also includes some re-organizing of the cloudflare pages section.

๐Ÿ”— Linked issue

โ“ Type of change

  • [x] ๐Ÿ“– Documentation (updates to the documentation or readme)
  • [ ] ๐Ÿž Bug fix (a non-breaking change that fixes an issue)
  • [ ] ๐Ÿ‘Œ Enhancement (improving an existing functionality)
  • [ ] โœจ New feature (a non-breaking change that adds functionality)
  • [ ] ๐Ÿงน Chore (updates to the build process or auxiliary tools and libraries)
  • [ ] โš ๏ธ Breaking change (fix or feature that would cause existing functionality to change)

๐Ÿ“š Description

Hebilicious avatar Mar 17 '25 12:03 Hebilicious

The current config and docs are valid ๐Ÿ’ฏ

Thinking would be better advise new users to use the new managed deployConfig feature flag.

export default defineNuxtConfig({
  compatibilityDate: "2025-03-01",
  nitro: { cloudflare: { nodeCompat: true, deployConfig: true } }
});

It generates all proper config (including compat flags and asset binding with valid path).

Cloudflare starter template for Nuxt already updated with this and Nitro docs should be updated as well.

pi0 avatar Mar 18 '25 14:03 pi0

The current config and docs are valid ๐Ÿ’ฏ

Thinking would be better advise new users to use the new managed deployConfig feature flag.

export default defineNuxtConfig({
  compatibilityDate: "2025-03-01",
  nitro: { cloudflare: { nodeCompat: true, deployConfig: true } }
});

It generates all proper config (including compat flags and asset binding with valid path).

Cloudflare starter template for Nuxt already updated with this and Nitro docs should be updated as well.

I don't mind making the change, but what is the behaviour of this flag ? If I'm adding anything custom to my wrangler.jsonc, such as a route or observability, does deployConfig override wrangler.jsonc? Or does it merges some properties with a user provided one?

Should we meet in the middle and recommend in this docs using deployConfig as an alternative to the user controlled wrangler.jsonc ? There's a subset of user that definitely prefer avoiding the abstractions.

Hebilicious avatar Mar 18 '25 21:03 Hebilicious

Yes, it will be merged if the user config exists.

We had been working with the cloudflare team for months to achieve this functionality (that is the default for the ongoing vite plugin and new nitro) -- it is only not enabled today because cloudflare needs safer migration for existing deployments.

pi0 avatar Mar 18 '25 21:03 pi0

@pi0 got it, I made changes to recommend the use of these flags and provided more context.

Hebilicious avatar Mar 20 '25 00:03 Hebilicious

@pi0 I stumbled back onto this, made some changes to resolve the comments, resolved merge conflicts and added a section on advanced configuration. What do you think ?

It's been open for 6 months now, so please feel free to make necessary changes directly to get this merged.

Hebilicious avatar Sep 13 '25 13:09 Hebilicious