-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Closed
Description
Version
v25.1.0
Platform
Microsoft Windows NT 10.0.26200.0 x64
Subsystem
No response
What steps will reproduce the bug?
- Create .a.env, and .b.env.
- .a.env includes: "ENV_VAR_A=123".
- .b.env includes: "ENV_VAR_B=456".
- create index.js that does this:
console.log(process.env.ENV_VAR_A)
- Run "node --env-file=.a.env --env-file=.b.env --watch index.js".
- Result output "undefined" (instead of 123)
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
Expected to see "123", because both .env files should be included and loaded as the command says. Notice that the env vars in those 2 files are different, so those 2 files should be "merged" as result, instead of be completely overwritten by the last one.
What do you see instead?
It always output "undefined" when "--watch" is added. It does output "123" when "--watch" is removed.
Additional information
Until Node.js v24.4, the multiple --env-file works well with --watch. I updated to v25.1.0 yesterday, and this pattern no longer works. As I've mentioned above, highly likely this is caused by "--watch" flag.
Metadata
Metadata
Assignees
Labels
No labels