Skip to content

Noam3kCH/dotenv-webpack

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dotenv-webpack

A simple webpack plugin to support dotenv.

Status

npm Travis Coverage Status Dependency Status devDependency Status js-standard-style npm pull requests

Installation

Include the package locally in your repository.

npm install dotenv-webpack --save

Usage

The plugin can be installed with little-to-no configuration needed. Once installed, you can access the variables as expected within your code using process.env.

The example bellow shows the defaults, as well as a description of each parameter.

// webpack.config.js
const Dotenv = require('dotenv-webpack');

module.exports = {
  ...
  plugins: [
    new Dotenv({
      path: './.my.env', // if not simply .env
      safe: true // lets load the .env.example file as well
    })
  ]
  ...
};

Properties

Use the following properties to configure your instance.

  • path ('./.env') - The path to your environment variables.
  • safe (false) - If false ignore safe-mode, if true load './.env.example', if a string load that file as the sample.
  • systemvars (false) - Set to true if you would rather load all system variables as well (useful for CI purposes).

LICENSE

MIT

About

A simple webpack plugin to support dotenv.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%