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

docs: add cloudflare workers section #1808

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Hebilicious
Copy link
Member

@Hebilicious Hebilicious commented Mar 17, 2025

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

  • 📖 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

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.
@Hebilicious Hebilicious requested a review from pi0 March 18, 2025 14:07
@pi0
Copy link
Member

pi0 commented Mar 18, 2025

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.

@Hebilicious
Copy link
Member Author

Hebilicious commented Mar 18, 2025

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.

@pi0
Copy link
Member

pi0 commented Mar 18, 2025

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.

@Hebilicious
Copy link
Member Author

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

```

This approach is recommend as it will generate a properly configured minimal `wangler.jsonc` for you. If you need to add Cloudflare settings, provide your own `wrangler.jsonc` and it will be merged with the correct Nitro options.
For advanced use cases, if you want manual control over the cloudflare settings, set `nodeCompat` and `deployConfig` to false and manually provide your own `wrangler.jsonc` with the appropriate configuration :
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For advanced use cases, there is also no need to disable any of that flag (they are compatible). We can instead advice users to use cloudflare: { wrangler: {} } section of the config.


::tip
**Zero Configuration ✨**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Module format is also zero config. nodeCompat is additional feature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants