nitrojs / nitrojs/nitro

[Cloudflare] Environment & vite modes support

Open
#4,300 1 comment 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement v3
Dominant language
TypeScript
Stars
11.2k
Forks
899
Avg merge
2d 24m
Merged PRs (30d)
40

Description

Describe the feature

Links:

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.