Registry / devops / envkey-webpack-plugin

envkey-webpack-plugin

JSON →
library2.5.1jsnpmunverified

A webpack plugin that wraps EnvKey's Node.js library to inject allow-listed environment variables from EnvKey into browser apps via process.env. Version 2.5.1 is stable; the package is part of the EnvKey ecosystem (encrypted environment variable management). Unlike generic dotenv plugins, this fetches variables from EnvKey servers using an ENVKEY, with an allow-list (permitted) to avoid leaking secrets. Requires webpack as a peer dependency. Release cadence is irregular, tied to EnvKey platform updates.

npm install envkey-webpack-plugin
INSTALL
IMPORT
SIG · ENVKEY-WEBPACK-PLU
E
envkey-webpack-plugin
devopsjavascriptv2.5.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

EnvkeyWebpackPlugin
const EnvkeyWebpackPlugin = require('envkey-webpack-plugin');
import EnvkeyWebpackPlugin from 'envkey-webpack-plugin';
The package does not ship TypeScript declarations; CommonJS require is standard for webpack config files. ESM import may fail.
default export
const EnvkeyWebpackPlugin = require('envkey-webpack-plugin');
const { default: EnvkeyWebpackPlugin } = require('envkey-webpack-plugin');
CommonJS default export is the entire function/class; no named default export.
Constructor options
new EnvkeyWebpackPlugin({ permitted: ['VAR1'], dotEnvFile: '.env', define: { EXTRA: 'val' } })
new EnvkeyWebpackPlugin({ allowed: ['VAR1'] })
The option key is 'permitted', not 'allowed' or 'allowlist'. 'dotEnvFile' is optional but defaults to loading .env. 'define' is optional.

Basic configuration of envkey-webpack-plugin with required permitted list and optional dotEnvFile and define options.

// webpack.config.js const EnvkeyWebpackPlugin = require('envkey-webpack-plugin'); module.exports = { // ... other config plugins: [ new EnvkeyWebpackPlugin({ permitted: ['API_URL', 'PUBLIC_KEY'], dotEnvFile: '.env', define: { ADDITIONAL: 'value' } }) ] };
Debug
Known issues
gotchaAll variables from EnvKey are injected into process.env, but only those in the 'permitted' list are allowed. Unlisted vars will be ignored.
fix
Explicitly list every variable you want available in the browser in the 'permitted' array. Do not rely on default behavior to include anything.
affects: *
deprecatedOld versions may not support the 'dotEnvFile' option. Always check compatibility with your webpack version.
fix
Upgrade to v2+ or pass ENVKEY via environment variable directly before webpack build.
affects: <2.0
gotchaThe plugin only works at build time; variables are statically replaced via webpack's DefinePlugin. Runtime changes to EnvKey will not be reflected until a new build.
fix
Rebuild the application to pick up updated environment variable values. This is expected behavior for compile-time injection.
affects: *
gotchaUsing 'define' overrides variables with the same name from EnvKey. Order: EnvKey values are loaded first, then 'define' values overwrite them.
fix
If you want EnvKey values to take precedence, do not include them in 'define'. Check for naming conflicts.
affects: *
gotchaThe plugin requires a valid ENVKEY to be present either in the dotEnvFile or as an environment variable in the build process. Missing ENVKEY causes build failure.
fix
Ensure your .env file has ENVKEY=... or set the ENVKEY environment variable in your CI/build system.
affects: *
Errors
Common errors & fixes
Error: Cannot find module 'envkey-webpack-plugin'
Package not installed or not installed as dev dependency.
fix
Run `npm install envkey-webpack-plugin --save-dev` in your project root.
TypeError: EnvkeyWebpackPlugin is not a constructor
Incorrect import (ESM default import in CommonJS context) or using an outdated version that exports differently.
fix
Use `const EnvkeyWebpackPlugin = require('envkey-webpack-plugin');` (CommonJS) instead of `import`.
Error: ENVKEY not found. Please set ENVKEY environment variable or include it in your dotenv file.
Missing or invalid ENVKEY in environment or .env file.
fix
Add ENVKEY=your_key to the .env file (or set it as an environment variable). Ensure the key is valid and not expired.
Upgrade
Version history
2.5.1latest on npm
Audit
Dependencies
webpackrequiredpeer dependency required for plugin integration
Agent activity
13 hits · last 30 days
node
12
OpenAI (training)
1
Resources
envkey-webpack-plugin — npm install envkey-webpack-plugin · libregistry