From ed1df224443dc6dc6b5b486bd1b49cd2b16c2c86 Mon Sep 17 00:00:00 2001 From: deepshekhardas Date: Mon, 2 Mar 2026 12:21:49 +0530 Subject: [PATCH] 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 --- packages/cli-v3/src/utilities/dotEnv.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/cli-v3/src/utilities/dotEnv.ts b/packages/cli-v3/src/utilities/dotEnv.ts index 83cb92822ab..e06e159b11d 100644 --- a/packages/cli-v3/src/utilities/dotEnv.ts +++ b/packages/cli-v3/src/utilities/dotEnv.ts @@ -3,10 +3,10 @@ import { resolve } from "node:path"; import { env } from "std-env"; const ENVVAR_FILES = [ - ".env", - ".env.development", - ".env.local", ".env.development.local", + ".env.local", + ".env.development", + ".env", "dev.vars", ];