Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

webpack-config-env

webpack-config7CC0-1.00.1.0

Inject environment variables into your [webpack] build.

readme

webpack-config-env

Inject environment variables into your webpack build.

build status coverage license version downloads

Usage

Install:

npm install --save webpack-config-env

Add to your webpack.config.babel.js:

import env from `webpack-config-env`;

env({
  NODE_ENV: {required: false},
  DEPLOY_ENV: {required: process.env.NODE_ENV === 'production'},
  API_URL: {
    required: true,
    value: process.env.NODE_ENV !== 'production'
     ? 'https://my-app-api.herokuapp.com/api'
     : undefined,
  },
})({
  /* existing webpack configuration */
})