M
process.loadEnvFile
History
Added in: v21.7.0, v20.12.0
v21.7.0, v20.12.0
Introduced in: v0.10.0
v0.10.0
This API is no longer experimental.
v24.10.0, v22.21.0
process.loadEnvFile(path?): void
Attributes
Loads the .env file into process.env. Usage of NODE_OPTIONS
in the .env file will not have any effect on Node.js.
const { loadEnvFile } = require('node:process'); loadEnvFile();
import { loadEnvFile } from 'node:process'; loadEnvFile();