{"id":16184604,"url":"https://github.com/rmariuzzo/config-webpack-plugin","last_synced_at":"2025-06-14T18:03:14.987Z","repository":{"id":57205445,"uuid":"65067336","full_name":"rmariuzzo/config-webpack-plugin","owner":"rmariuzzo","description":"💫 Merge one or more configuration files together with environment variables too.","archived":false,"fork":false,"pushed_at":"2016-08-20T20:44:44.000Z","size":2921,"stargazers_count":18,"open_issues_count":0,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-11T07:10:34.993Z","etag":null,"topics":["configuration","configuration-by-environment","javascript","webpack","webpack-plugin"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rmariuzzo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-08-06T05:50:26.000Z","updated_at":"2021-06-23T22:14:14.000Z","dependencies_parsed_at":"2022-09-18T01:32:34.080Z","dependency_job_id":null,"html_url":"https://github.com/rmariuzzo/config-webpack-plugin","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rmariuzzo%2Fconfig-webpack-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rmariuzzo%2Fconfig-webpack-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rmariuzzo%2Fconfig-webpack-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rmariuzzo%2Fconfig-webpack-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rmariuzzo","download_url":"https://codeload.github.com/rmariuzzo/config-webpack-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221720421,"owners_count":16869483,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["configuration","configuration-by-environment","javascript","webpack","webpack-plugin"],"created_at":"2024-10-10T07:10:41.685Z","updated_at":"2024-10-27T19:09:06.294Z","avatar_url":"https://github.com/rmariuzzo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# config-webpack-plugin\n\n\u003e 💫 Merge one or more configuration files together with environment variables too.\n\n## Installation\n\n```sh\nnpm install config-webpack-plugin --save-dev\n```\n\n### How it works?\n\nLet's say you have a base configuration file (`./config.js`) shared across your team. Now, you want for every developer to be able to override any configuration value without modifying the base configuration file. Therefore, every developer can create a _local_ configuration file (`./config.local.js`). And… `config-webpack-plugin` will do the rest for you.\n\n**`webpack.config.js`:**\n```js\nconst ConfigPlugin = require('config-webpack-plugin')\n\nmodule.exports = {\n    plugins: [\n        new ConfigPlugin([\n            './config.js',\n            './config.local.js'\n        ])\n    ]\n}\n```\n\n 1. The `config-webpack-plugin` will merge all specified configuration file contents from _right to left_, thus creating a _‘merged configuration’_.\n    ![Merging configuration files](https://github.com/rmariuzzo/config-webpack-plugin/raw/master/img/merging-config-files.png)\n\n 2. If the _‘merged configuration’_ contains a `key` matching a current environment variable then the related `value` will be replaced by the environment variable's value.\n    ![Environment variables replacements](https://github.com/rmariuzzo/config-webpack-plugin/raw/master/img/env-vars-replacement.png)\n\n 3. Finally, the `config-webpack-plugin` will intercept the _‘main configuration’_ file (the first specified) during webpack's module resolution and will replace its source with the _‘merged configuration’_.\n\n## Usage\n\n### Single configuration\n\n```js\nconst ConfigPlugin = require('config-webpack-plugin');\n\nmodule.exports = {\n    plugins: [\n        new ConfigPlugin('./config.js')\n    ]\n}\n```\n\n### Multiple configuration\n\n```js\nconst ConfigPlugin = require('config-webpack-plugin');\n\nmodule.exports = {\n    plugins: [\n        new ConfigPlugin([\n            './config.js',\n            './config.local.js'\n        ])\n    ]\n}\n```\n\n## FAQ\n\n### What is a configuration file?\n\nA module that export an object with key/value pairs that looks like:\n\n```js\nmodule.exports = {\n    API_BASE_URL: 'http://localhost/',\n    NODE_ENV: 'development',\n    AUTH_SPOOFED: true,\n}\n```\n\n### Does my configuration file gets modified?\n\nNo.\n\n## Development\n\nIf you want to collaborate with the development of `config-webpack-plugin` you need to have installed NodeJS 6 and Gulp. Then follow these instructions to make my life easier:\n\n 1. Fork this repo.\n 2. Clone your forked repo.\n 3. Create a _feature branch_ with: `git checkout develop; git checkout -b feature/\u003cname-of-feature\u003e`.\n 4. Create a pull request **to be merged into `develop` branch**.\n\n \u003e 💁 Please, do not submit PR to be merged into `master` branch.\n\n### Roadmap\n\n - [x] [Add test. Please!](https://github.com/rmariuzzo/config-webpack-plugin/issues/4)\n - [x] [Add CI. Please!](https://github.com/rmariuzzo/config-webpack-plugin/issues/5)\n - [x] [Support multiple file](https://github.com/rmariuzzo/config-webpack-plugin/issues/2) (`new ConfigPlugin(['./config.default.js', '.config.local.js'])`).\n - [ ] Support JSON file too ♥️, because they are prettiest for configuration.\n - [ ] [Add a static website using GitHub Pages](https://github.com/rmariuzzo/config-webpack-plugin/issues/3) (why not?).\n\n \u003e 💁 Do you want to suggest a feature? [Add a suggestion](https://github.com/rmariuzzo/config-webpack-plugin/issues/new).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frmariuzzo%2Fconfig-webpack-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frmariuzzo%2Fconfig-webpack-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frmariuzzo%2Fconfig-webpack-plugin/lists"}