Repository navigation
Config factories cannot tell cf dev from cf build / cf deploy
#650
workers-devprod
started this conversation in
Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Moved from #613. Originally opened by kenwongkaien on 2026-09-29.
Problem
A
cloudflare.config.tsfactory getsConfigContext = { mode, isPreview }and nothing more (@cloudflare/config@0.20.0). So it cannot tell whether it is being evaluated forcf dev,cf buildorcf deploy.We use
--modeas an environment name:dev_<user>runs locally only, andstaging/prodare deployed only. We want the config itself to refuse the wrong pairing, a local-only mode in a build or deploy and a deployed mode in dev. With onlymode, the factory can refuse an unknown mode but cannot refuse the pairing. So that guard has to live outside the config, in the Vite config's dev server and in CI.Expected
ConfigContextexposes the command or phase it is evaluated for (for examplecommand: "dev" | "build" | "deploy" | "types"), the way Vite'sConfigEnvexposescommand.Environment
cf@1.0.0-beta.5,@cloudflare/vite-plugin@2.0.0-beta.sha-ad79608dd,@cloudflare/config@0.20.0.workers-devprod commented on 2026-10-07:
Automated triage
Issue assessment
enhancement(high)package:config(high)package:vite-plugin(medium)Actionability and missing information
Feature request: ConfigContext exposes only mode and isPreview, so a config factory cannot distinguish cf dev from cf build or cf deploy; the report asks to add a command field like Vite's ConfigEnv.command, citing cf 1.0.0-beta.5 and the beta vite plugin.
Reproduction reason: The report is a feature request for a new ConfigContext command field and describes no unexpected current behavior defect that reproduction would confirm.
This summary was generated by an LLM and may contain errors. Please verify its findings.
Triage bot commands and options
Repository collaborators with write or admin access can trigger actions by commenting on this issue:
@workers-devprod reproduce: Attempt to reproduce the issue using its description and recent comments.All reactions