-
-
Couldn't load subscription status.
- Fork 1.3k
docs: add note to set CLOUDFLARE_ENV for wrangler to load correct env… #5609
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
base: main
Are you sure you want to change the base?
Conversation
WalkthroughAdded 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
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes
Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
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. Comment |
There was a problem hiding this 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
📒 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.mddocs/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.mddocs/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.
This PR adds a note to the environment variable docs to add
CLOUDFLARE_ENVto.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 specifiesCLOUDFLARE_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 whereCLOUDFLARE_ENVwas specified)Setting
CLOUDFLARE_ENV=developmentin.env.developmentshould be enough to get most people startedSummary by CodeRabbit