Webpack plugin that makes variables from a .env.js file available as global constants in your webpack bundles. Version 0.8.0 (latest) – no recent updates, low maintenance. Key differentiator: simple environment variable injection without additional loaders. Alternatives like dotenv-webpack offer more features and active support.
npm install webpack-envVerified import paths — ran on the pinned version, not inferred.
Sets up webpack-env plugin with gulp and a .env.js file defining globals.
Use plugins: [require('webpack-env')] not plugins: [new require('webpack-env')]Use module.exports = { ... } instead of export default { ... }Migrate to dotenv-webpack: install dotenv-webpack and use new Dotenv() in plugins.
Manually set NODE_ENV before build to switch files.
Use plugins: [require('webpack-env')] instead of plugins: [new require('webpack-env')]Not recommended for browser-only build; use dotenv-webpack or DefinePlugin.
Create .env.js in project root with module.exports = { SOME_VAR: 'value' }Create .env.js file in the root directory containing module.exports = { ... }No dependency data recorded yet.