{"library":"node-config-webpack","title":"Webpack Plugin for Node-Config","description":"node-config-webpack is a Webpack plugin designed to integrate the `config` module's functionality directly into Webpack builds. It replaces the dynamic runtime loading of configuration, characteristic of `node-config`, with a compile-time mechanism. This approach ensures that environment-specific configuration values are embedded directly into the bundled output, eliminating the need to include the `config` module as a runtime dependency for applications where configuration is static at build time. The plugin supports injecting configuration either into `process.env` (with options for key coercion to uppercase or direct object assignment) or as a global constant within the bundle. The current stable version is 1.0.10. While not under rapid development, it provides a stable solution for environments that leverage `node-config` and require optimized, compile-time configuration embedding, offering a direct integration path not typically found in generic Webpack `DefinePlugin` setups.","language":"javascript","status":"maintenance","last_verified":"Tue Apr 21","install":{"commands":["npm install node-config-webpack"],"cli":null},"imports":["const NodeConfigWebpack = require('node-config-webpack');","plugins: [new NodeConfigWebpack()]","new NodeConfigWebpack({ env: true })"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const NodeConfigWebpack = require('node-config-webpack');\nconst path = require('path');\n\nmodule.exports = {\n  mode: 'development',\n  entry: './src/index.js',\n  output: {\n    filename: 'bundle.js',\n    path: path.resolve(__dirname, 'dist'),\n  },\n  plugins: [\n    new NodeConfigWebpack({\n      // Example: Inject config into process.env, coercing keys to uppercase\n      env: true\n    })\n  ],\n  // Ensure 'config' module is not externalized if using node-externals\n  externals: [\n    // In a server-side webpack config, if using webpack-node-externals,\n    // you MUST allowlist 'config' for this plugin to work.\n    // e.g., nodeExternals({ allowlist: ['config'] })\n  ]\n};\n\n// src/index.js example (assuming you have a 'config' package and a 'config/default.json' with { \"version\": \"1.0.0\" })\n// console.log('Configuration version is', process.env.VERSION); // Output: Configuration version is 1.0.0\n","lang":"javascript","description":"Demonstrates basic setup of `node-config-webpack` in `webpack.config.js` to inject configuration into `process.env` at compile time.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}