Skip to content

Conversation

@lotap
Copy link

@lotap lotap commented Oct 24, 2025

This PR adds a note to the environment variable docs to add CLOUDFLARE_ENV to .env.<environment> files.

Without specifying a Cloudflare environment, it will default to the top-level (production), so vars specified in .env.development would never be loaded

Cloudflare Docs about .env on local

The solution comes from Combining Cloudflare environments and Vite modes.

Vite loads the correct .env.<environment> file and that file specifies CLOUDFLARE_ENV. Then the Cloudflare Vite plugin will select the given Cloudflare environment, which means Wrangler will load the corresponding .env.<environment> (even if it's the same file where CLOUDFLARE_ENV was specified)

Setting CLOUDFLARE_ENV=development in .env.development should be enough to get most people started

Summary by CodeRabbit

  • Documentation
    • Added guidance to set CLOUDFLARE_ENV when using the Cloudflare Vite plugin so Wrangler loads the correct environment and environment-specific variables are injected into process.env. Tip added within the Environment Variables guides for both React and Solid, including an example for .env.development.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 24, 2025

Walkthrough

Added user-facing tip blocks to React and Solid framework environment variables guides instructing to set the CLOUDFLARE_ENV variable when using the Cloudflare Vite plugin so Wrangler loads the correct .env. files. Changes are documentation-only; no code or public API changes.

Changes

Cohort / File(s) Change Summary
Environment variables guides
docs/start/framework/react/guide/environment-variables.md, docs/start/framework/solid/guide/environment-variables.md
Inserted tip blocks in two locations per file advising to set CLOUDFLARE_ENV when using the Cloudflare Vite plugin, with an example (.env.development) and a note that without it .env.<environment> variables may not be read or injected into process.env.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • Documentation-only additions, identical tip content applied to two files.
  • Review focus: wording accuracy and placement in both guides.

Possibly related PRs

  • Update hosting.md #5252 — Related documentation changes around Cloudflare Vite plugin and Wrangler deployment/setup that overlap in subject matter.

Poem

🐰 In fields of docs I hop and write,

Set CLOUDFLARE_ENV to guide the light,
.env.development tucked away,
Wrangler finds it when you say,
Hooray—your envs load just right! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title "docs: add note to set CLOUDFLARE_ENV for wrangler to load correct env…" accurately reflects the main changes in the pull request. The modifications add documentation tips to two environment variables guides (React and Solid frameworks) instructing users to set CLOUDFLARE_ENV when using the Cloudflare Vite plugin to ensure Wrangler loads the correct environment. The title is concise, uses the standard "docs:" prefix, and clearly identifies the primary change—adding documentation about setting an environment variable for Wrangler configuration. A teammate reviewing the commit history would understand that this PR introduces guidance on CLOUDFLARE_ENV setup without needing exhaustive details about each affected file.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dd40f4c and 958eae2.

📒 Files selected for processing (2)
  • docs/start/framework/react/guide/environment-variables.md (1 hunks)
  • docs/start/framework/solid/guide/environment-variables.md (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • docs/start/framework/solid/guide/environment-variables.md
  • docs/start/framework/react/guide/environment-variables.md

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added the documentation Everything documentation related label Oct 24, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
docs/start/framework/solid/guide/environment-variables.md (1)

101-109: Minor formatting inconsistency in bash code block.

Line 105 has a leading space before the comment marker: # .env.development. Other bash code blocks in the file (lines 13, 116) omit this leading space. Align formatting for consistency.

  > ```bash
- >  # .env.development
+ > # .env.development
  > CLOUDFLARE_ENV=development
  > ```
docs/start/framework/react/guide/environment-variables.md (1)

101-109: Minor formatting inconsistency in bash code block.

Line 105 has a leading space before the comment marker: # .env.development. Other bash code blocks in the file (lines 13, 116) omit this leading space. Align formatting for consistency.

  > ```bash
- >  # .env.development
+ > # .env.development
  > CLOUDFLARE_ENV=development
  > ```
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 20ea994 and dd40f4c.

📒 Files selected for processing (2)
  • docs/start/framework/react/guide/environment-variables.md (1 hunks)
  • docs/start/framework/solid/guide/environment-variables.md (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
docs/**/*.{md,mdx}

📄 CodeRabbit inference engine (AGENTS.md)

Use internal docs links relative to the docs/ folder (e.g., ./guide/data-loading)

Files:

  • docs/start/framework/solid/guide/environment-variables.md
  • docs/start/framework/react/guide/environment-variables.md
docs/{router,start}/**

📄 CodeRabbit inference engine (AGENTS.md)

Place router docs under docs/router/ and start framework docs under docs/start/

Files:

  • docs/start/framework/solid/guide/environment-variables.md
  • docs/start/framework/react/guide/environment-variables.md
🔇 Additional comments (2)
docs/start/framework/solid/guide/environment-variables.md (1)

101-109: Documentation content is clear and well-positioned.

The TIP block accurately conveys the Cloudflare environment configuration requirement and is logically placed after the file hierarchy explanation. The scoped guidance ("When using the Cloudflare Vite plugin") appropriately targets the relevant audience.

docs/start/framework/react/guide/environment-variables.md (1)

101-109: Documentation content is clear and well-positioned.

The TIP block accurately conveys the Cloudflare environment configuration requirement and is logically placed after the file hierarchy explanation. Consistency across React and Solid framework guides improves the developer experience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Everything documentation related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant