Advanced
dotenvx.config(path: ['.env.local', '.env'])
Specify path(s) to multiple .env files.
# .env.local
HELLO="Me"
# .env
HELLO="World"
// index.js
require('@dotenvx/dotenvx').config({path: ['.env.local', '.env']})
console.log(`Hello ${process.env.HELLO}`)
$ node index.js
[[email protected]] injecting env (1) from .env.local, .env
Hello Me
This is the equivalent of using -f
from the command line.