envkey-webpack-plugin
A webpack plugin that wraps EnvKey's Node.js library so you can easily inject allow-listed configuration into your browser apps.
All vars will be available on process.env
in the browser.
To make process.env.NODE_ENV
available, just add it to the permitted
allow-list (see below).
Install
npm i envkey-webpack-plugin --save-dev
Usage
var webpack = require("webpack"),
EnvkeyWebpackPlugin = require("envkey-webpack-plugin");
module.exports = {
plugins: [
new EnvkeyWebpackPlugin({
permitted: ["STRIPE_PUBLISHABLE_KEY", "PUSHER_APP_KEY", "NODE_ENV"],
dotEnvFile: ".env",
define: { ANOTHER_VAR: "anotherVal" },
}),
],
};