From c7c0ee654aba1dbae7694f537c5ad9abe5a7d8a5 Mon Sep 17 00:00:00 2001 From: Sam Yao <43796777+yaohuangguan@users.noreply.github.com> Date: Fri, 2 Oct 2026 12:25:12 +1300 Subject: [PATCH] doc: clarify loadEnvFile precedence Signed-off-by: Sam Yao <43796777+yaohuangguan@users.noreply.github.com> --- doc/api/process.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/api/process.md b/doc/api/process.md index 8b210a1e7c06..c26ff5e2e3f9 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -2723,8 +2723,10 @@ changes: * `path` {string | URL | Buffer | undefined}. **Default:** `'./.env'` -Loads the `.env` file into `process.env`. Usage of `NODE_OPTIONS` -in the `.env` file will not have any effect on Node.js. +Loads the `.env` file into `process.env`. If a variable is already defined in +`process.env`, its existing value takes precedence and is not overwritten by the +`.env` file. Usage of `NODE_OPTIONS` in the `.env` file will not have any effect +on Node.js. ```cjs const { loadEnvFile } = require('node:process');