Skip to content

Commit ed1df22

Browse files
author
deepshekhardas
committed
fix(cli): ensure .env.local overrides .env values in dev command
The ENVVAR_FILES array listed .env before .env.local, but dotenv uses first-match-wins when given an array of paths. This meant .env always took precedence over .env.local, contrary to the standard convention used by Next.js, Vite, and other frameworks. Reversed the array order so more specific files (.env.development.local, .env.local) are listed first and take proper precedence. Fixes #2999
1 parent e1f8134 commit ed1df22

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/cli-v3/src/utilities/dotEnv.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import { resolve } from "node:path";
33
import { env } from "std-env";
44

55
const ENVVAR_FILES = [
6-
".env",
7-
".env.development",
8-
".env.local",
96
".env.development.local",
7+
".env.local",
8+
".env.development",
9+
".env",
1010
"dev.vars",
1111
];
1212

0 commit comments

Comments
 (0)