Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dotenv-load

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dotenv-load

Load environment variables from .env, .env.local, .env.production, etc. when running a npm or yarn command

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9.7K
decreased by-16%
Maintainers
1
Weekly downloads
 
Created
Source

dotenv-load code style: prettier

Load environment variables from .env, .env.local, .env.production, etc. when running a npm or yarn command.

This dotenv loading behaviour was extracted from create-react-app to be also usable with non create-react-app projects like next.js or any other node specific project.

Usage

Use in yarn or npm commands

dotenv-load can be used in an yarn/npm command:

{
  "scripts": {
    "dev": "dotenv-load node server.js",
    "build": "NODE_ENV=production dotenv-load node server.js"
  }
}

Use in node script

dotenv-load can be used in an yarn/npm command:

const dotenvLoad = require('dotenv-load');
dotenvLoad();

ignore .local files

add .local files to .gitignore

.env.local
.env.development.local
.env.production.local

What other .env* files can I use?

dotenv-load will load the following files, starting from the bottom. The first value set (or those already defined in the environment) take precedence:

  • .env - The Original®
  • .env.development, .env.test, .env.production - Environment-specific settings.
  • .env.local - Local overrides. This file is loaded for all environments except test.
  • .env.development.local, .env.test.local, .env.production.local - Local overrides of environment-specific settings.

Keywords

FAQs

Package last updated on 03 Jul 2018

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc