`celld dev` does not read `.env`, but `wrangler dev` reads it when there is no `.dev.vars`
kayue opened ·
In v0.6.0, `celld dev` reads Worker variables only from `.dev.vars` beside the config. It does not read `.env`:
https://github.com/denoland/celld/blob/bad4649d01f0db84cdc9093527e72e64ca7a14bf/crates/celld/dev.rs#L484-L492
`wrangler dev` reads `.dev.vars` first. When there is no `.dev.vars`, it reads `.env` and then `.env.local` from the same directory ([`getVarsForDev`](https://github.com/cloudflare/workers-sdk/blob/1d789fc1ec100eb0308127fd739194bf4a94a3c0/packages/wrangler/src/dev/dev-vars.ts#L78-L102)). The [Cloudflare docs](https://developers.cloudflare.com/workers/configuration/environment-variables/#local-development-with-secrets) give both files for local development:
> Put secrets for use in local development in either a `.dev.vars` file or a `.env` file, in the same directory as the Wrangler configuration file.
`docs/README.md` says that the command reads `.dev.vars` "as `wrangler dev` does", and the help of `celld dev` says the same. But a project that keeps its local variables in `.env` gets none of them under `celld dev`. Each one is `undefined` in the Worker, and celld gives no warning.
## Repro
`wrangler.jsonc`:
```jsonc { "name": "dotenv-repro", "main": "index.js", "compatibility_date": "2026-09-26" } ```
`index.js`:
```js export default { fetch(request, env) { return Response.json({ GREETING: env.GREETING ?? null }); }, }; ```
```sh echo 'GREETING=hello' > .env celld dev curl http://127.0.0.1:9876/ ```
- Expected, as with `wrangler dev`: `{"GREETING":"hello"}` - Actual: `{"GREETING":null}`
With the same line in `.dev.vars` instead, the response is `{"GREETING":"hello"}`.
celld 0.6.0, macOS arm64.
bartlomiejureferenced 655ff6caf8b6last month on GitHub
bartlomiejureferenced 90b43017241flast month on GitHub
- BA
Fixed in v0.6.2: `celld dev` reads `.env` and `.env.local` when there is no `.dev.vars`, as `wrangler dev` does.