You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Multiple --env-file no longer work with --watch #60599
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.
I've looked into this briefly. This was introduced in version 25.1. In v25.0 it works as expected. Also, it is only observable in watch mode; running node --env-file=a.env --env-file=b.env index.js prints the correct output.
Activity
StefanStojanovic commentedon Nov 6, 2025
I've looked into this briefly. This was introduced in version 25.1. In v25.0 it works as expected. Also, it is only observable in watch mode; running
node --env-file=a.env --env-file=b.env index.jsprints the correct output.targos commentedon Nov 6, 2025
Likely caused by #60178
marco-ippolito commentedon Nov 6, 2025
confirm it has been caused by #60178 I'm working on a fix
watch: fix interaction with multiple env files
watch: fix interaction with multiple env files
watch: fix interaction with multiple env files