webpack-env-prefix-plugin

Webpack plugin to populate process.env with prefixed env vars e.g. REACT_APP

Usage no npm install needed!

<script type="module">
  import webpackEnvPrefixPlugin from 'https://cdn.skypack.dev/webpack-env-prefix-plugin';
</script>

README

webpack-env-prefix-plugin

CI npm version License Buy me a coffee

Packages the REACT_APP_* env handling from create-react-app as a standalone webpack plugin.

Usage

npm install --save-dev webpack-env-prefix-plugin
// webpack.config.js
const EnvPrefixPlugin = require('webpack-env-prefix-plugin')

module.exports = {
  plugins: [
    new EnvPrefixPlugin()
  ]
}
const config = {
  NODE_ENV: process.env.NODE_ENV,
  MY_CONFIG: process.env.REACT_APP_MY_CONFIG,
}