You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[wrangler] Add CF_PAGES environment variables to pages dev
Injects Pages-specific environment variables (CF_PAGES, CF_PAGES_BRANCH,
CF_PAGES_COMMIT_SHA, CF_PAGES_URL) during local development with
wrangler pages dev.
This enables frameworks like SvelteKit to auto-detect the Pages environment
during local development, improving dev/prod parity.
The variables can be overridden by user-defined vars in wrangler.toml,
.dev.vars, or via CLI flags.
Fixes#1440
Add CF_PAGES environment variables to `wrangler pages dev`
6
+
7
+
`wrangler pages dev` now automatically injects Pages-specific environment variables (`CF_PAGES`, `CF_PAGES_BRANCH`, `CF_PAGES_COMMIT_SHA`, `CF_PAGES_URL`) for improved dev/prod parity. This enables frameworks like SvelteKit to auto-detect the Pages environment during local development.
8
+
9
+
-`CF_PAGES` is set to `"1"` to indicate the Pages environment
10
+
-`CF_PAGES_BRANCH` defaults to the current git branch (or `"local"` if not in a git repo)
11
+
-`CF_PAGES_COMMIT_SHA` defaults to the current git commit SHA (or a placeholder if not in a git repo)
12
+
-`CF_PAGES_URL` is set to the local dev server URL
13
+
14
+
These variables can be overridden by user-defined vars in `wrangler.toml`, `.dev.vars`, or via CLI flags.
0 commit comments