webpack-dotenv-plugin
Use dotenv with webpack.
Last updated 2 years ago by nwinch .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install webpack-dotenv-plugin 
SYNC missed versions from official npm registry.

Webpack dotenv plugin

Use dotenv with webpack.

Motivation

dotenv is a fantastic and useful way to manage environment variables. I wanted to keep the good times going when working with webpack for frontend projects.

Install

npm i --save-dev webpack-dotenv-plugin

Usage

webpack-dotenv-plugin uses dotenv-safe under the hood to read and check environment variables. The same options that can be passed to dotenv-safe can be passed to this plugin.

It then reads, parses and exports the listed env vars from .env into stringified process.env so it can be bundled for use with webpack.

Externally set environment variables will override vars set in .env.

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

module.exports = {
  ...
  plugins: [
    new DotenvPlugin({
      sample: './.env.default',
      path: './.env'
    })
  ]
  ...
};

Current Tags

  • 2.1.0                                ...           latest (2 years ago)

10 Versions

  • 2.1.0                                ...           2 years ago
  • 2.0.2                                ...           3 years ago
  • 2.0.0                                ...           4 years ago
  • 1.4.0                                ...           4 years ago
  • 1.3.2                                ...           4 years ago
  • 1.3.1                                ...           4 years ago
  • 1.3.0                                ...           4 years ago
  • 1.2.0                                ...           4 years ago
  • 1.1.0                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 1
This Week 1
This Month 12
Last Day 0
Last Week 11
Last Month 2
Dependencies (1)
Dev Dependencies (0)
None

Copyright 2014 - 2017 © taobao.org |