Skip to content

Prismatik/webpack-dotenv-plugin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

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

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

About

Use dotenv with webpack.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%