package
Loads environment variables from a file
npm install @ns84/dotenvGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Estimated unpacked size across 1 packages.
8.8 kB
Includes dependencies.
Loads the environment variables from a .env file into process.env.
By default, it loads a file named .env in the current working directory. To
load a specific .env file, specify its path.
This function works exactly like process.loadEnvFile except that it does not
throw an error if the file doesn't exist.
For information on the format for .env files, see DotEnv.
npm install @ns84/dotenvimport { dotenv } from "@ns84/dotenv";
// Load environment variables from a file named `.env` (the default filename).
dotenv();
// Load environment variables from a file named `dev.env`.
dotenv("dev.env");
// Unlike `process.loadEnvFile` if the file doesn't exist, no error is thrown.
dotenv("fake.env");