Star on GitHub - 5.8k

-f

Compose multiple .env files for environment variables loading, as you need.

Usage

$ echo "HELLO=local" > .env.local
echo "HELLO=World" > .env
echo "console.log('Hello ' + process.env.HELLO)" > index.js

dotenvx run -f .env.local,.env -- node index.js
⟐ injected env (1) from .env.local, .env
Hello local

Comma-separate multiple files after a single -f. The order matters: subsequent files do NOT override pre-existing variables defined in previous files or env. This follows historic principle. For example, above local wins – from the first file.