🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

load-dotenv

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

load-dotenv

Automatically load the closest .env file

Source
npmnpm
Version
0.0.4
Version published
Weekly downloads
199
-44.72%
Maintainers
1
Weekly downloads
 
Created
Source

Load Dot ENV

Automatically load the closest .env file in any parent directory.

Install

npm i dotenv load-dotenv     # With npm
pnpm i dotenv load-dotenv    # With pnpm
yarn add dotenv load-dotenv  # With yarn

Find and load the closest .env file

Add this import before any other import in your project:

import 'load-dotenv/load';

Or load it yourself

import { findEnv } from 'load-dotenv';

const envFile = findEnv();
require('dotenv').config({ path: envFile });

Keywords

dotenv

FAQs

Package last updated on 28 Apr 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts