JSPM

  • Created
  • Published
  • Downloads 1069089
  • Score
    100M100P100Q183984F
  • License MIT

A simple webpack plugin to support dotenv.

Package Exports

  • dotenv-webpack

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (dotenv-webpack) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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