[Cloudflare] Environment & vite modes support
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 11.2k
- Forks
- 899
- Avg merge
- 2d 24m
- Merged PRs (30d)
- 40
Description
Describe the feature
Links:
- https://vite.dev/guide/env-and-mode#modes
- https://developers.cloudflare.com/workers/vite-plugin/reference/cloudflare-environments/
For a long time, Nitro has not supported Cloudflare environments. However, deploying by environment or enabling development is a very common requirement.
We could customize the main module entry point after compilation, but this would break the nitro/vite dev command.
The Cloudflare vite plugin offers a solution: combining the vite name and the environments name and configuring it using CLOUDFLARE_ENV. This greatly simplifies the generated deploy config (.output/server/wrangler.json).
Alternative: For vite, you can use @cloudflare/vite-plugin as the dev server. This alternative will break nitro dev, which I personally do not recommend.
Additional information
- Would you be willing to help implement this feature?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read the linked Vite modes and Cloudflare environments documentation first, then inspect how the nitro/vite dev command and generated .output/server/wrangler.json are handled. Trace how CLOUDFLARE_ENV could combine the Vite and Cloudflare environment names without breaking nitro dev. Done means environment-based deployment and development work while the generated Wrangler configuration uses the selected environment.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vite
- Domain
- cloud, devops
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100