A webpack plugin that extends DefinePlugin to load environment-specific configuration from files like config.{env}.json. It merges defaults (config.default.json) with environment-specific files and optionally loads local overrides and process.env values. The plugin exposes config under a global namespace (default: __CONFIG__) that webpack replaces at build time. It supports JSON and YAML config files. Version 1.0.0 is the latest stable release. Unlike dotenv or env-cmd, this plugin integrates directly into webpack's compilation process and can conditionally set React production mode via reactEnv option.
npm install webpack-env-loader-pluginNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Basic webpack configuration using EnvLoaderPlugin with NODE_ENV, React production mode, and custom config file pattern.
Ensure config values are strings or wrap them in JSON.stringify in the config file or in the plugin options using a custom transformer.
Do not rely on process.env overrides via this plugin; manually merge environment variables in your config file or use dotenv separately.
Refer to the changelog for migration steps; likely update option names to match current docs.
Instead of reactEnv: true, rely on NODE_ENV=production and webpack's mode setting to enable React production mode.
Use require('webpack-env-loader-plugin') in webpack.config.jsEnsure webpack.config.js includes the EnvLoaderPlugin in plugins array and that your source file is an entry point or module
Create config.default.json in the path specified (default: process.cwd()) or set loadDefault: false
No dependency data recorded yet.