On this page

    M

    process.loadEnvFile

    History
    process.loadEnvFile(path?): void
    Attributes
    . Default: './.env'

    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();