All Projects → rmariuzzo → config-webpack-plugin

rmariuzzo / config-webpack-plugin

Licence: MIT license
💫 Merge one or more configuration files together with environment variables too.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to config-webpack-plugin

sitemap-webpack-plugin
Webpack plugin to generate a sitemap.
Stars: ✭ 72 (+300%)
Mutual labels:  webpack-plugin
dotfiles
Linux configuration files (dotfiles) and some useful scripts
Stars: ✭ 22 (+22.22%)
Mutual labels:  configuration
Dark Souls Config Utility
All-in-one installer and configuration UI for various mods/fixes for Dark Souls™: Prepare to Die Edition.
Stars: ✭ 27 (+50%)
Mutual labels:  configuration
eruda-webpack-plugin
A webpack plugin of eruda to help you develop mobile app
Stars: ✭ 56 (+211.11%)
Mutual labels:  webpack-plugin
pconf
Hierarchical python configuration with files, environment variables and command-line arguments.
Stars: ✭ 17 (-5.56%)
Mutual labels:  configuration
crx-webpack-plugin
A webpack plugin to package chrome extensions (crx) post build
Stars: ✭ 21 (+16.67%)
Mutual labels:  webpack-plugin
webpack-bugsnag-plugins
Webpack plugins for common Bugsnag actions.
Stars: ✭ 29 (+61.11%)
Mutual labels:  webpack-plugin
konfsave
Easy saving and switching between multiple KDE configurations.
Stars: ✭ 42 (+133.33%)
Mutual labels:  configuration
sitri
Sitri - powerful settings & configs for python
Stars: ✭ 20 (+11.11%)
Mutual labels:  configuration
webpack-demos
webpack小练习
Stars: ✭ 17 (-5.56%)
Mutual labels:  webpack-plugin
asset-map-webpack-plugin
Webpack plugin that creates a map of assets to public url slug for server agnostic usage.
Stars: ✭ 14 (-22.22%)
Mutual labels:  webpack-plugin
image-minimizer-webpack-plugin
Webpack loader and plugin to compress images using imagemin
Stars: ✭ 180 (+900%)
Mutual labels:  webpack-plugin
leaflet-map-builder
gherardovarando.github.io/leaflet-map-builder/
Stars: ✭ 16 (-11.11%)
Mutual labels:  configuration
webpack-omit-js-for-css-plugin
This plugin will omit bundled JS files for dependencies that are exclusively CSS, which become obsolete once mini-css-extract-plugin extracts inlined CSS into its own .css file
Stars: ✭ 14 (-22.22%)
Mutual labels:  webpack-plugin
qn-webpack
Qiniu webpack plugin (七牛 Webpack 插件)
Stars: ✭ 39 (+116.67%)
Mutual labels:  webpack-plugin
webpack-extract-translation-keys
This plugin extracts translation keys for applications requiring runtime translations
Stars: ✭ 35 (+94.44%)
Mutual labels:  webpack-plugin
del-webpack-plugin
A file plugin help you remove old files after webpack (v5) bundling
Stars: ✭ 43 (+138.89%)
Mutual labels:  webpack-plugin
mock-webpack-plugin
A webpack plugin that starts a json mock server
Stars: ✭ 21 (+16.67%)
Mutual labels:  webpack-plugin
Flex-AntiCheat
Flex AntiCheat - Optimized Configs For Multiple AntiCheats
Stars: ✭ 37 (+105.56%)
Mutual labels:  configuration
swift-declarative-configuration
Declarative configuration for your objects
Stars: ✭ 46 (+155.56%)
Mutual labels:  configuration

config-webpack-plugin

💫 Merge one or more configuration files together with environment variables too.

Installation

npm install config-webpack-plugin --save-dev

How it works?

Let'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.

webpack.config.js:

const ConfigPlugin = require('config-webpack-plugin')

module.exports = {
    plugins: [
        new ConfigPlugin([
            './config.js',
            './config.local.js'
        ])
    ]
}
  1. The config-webpack-plugin will merge all specified configuration file contents from right to left, thus creating a ‘merged configuration’. Merging configuration files

  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. Environment variables replacements

  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’.

Usage

Single configuration

const ConfigPlugin = require('config-webpack-plugin');

module.exports = {
    plugins: [
        new ConfigPlugin('./config.js')
    ]
}

Multiple configuration

const ConfigPlugin = require('config-webpack-plugin');

module.exports = {
    plugins: [
        new ConfigPlugin([
            './config.js',
            './config.local.js'
        ])
    ]
}

FAQ

What is a configuration file?

A module that export an object with key/value pairs that looks like:

module.exports = {
    API_BASE_URL: 'http://localhost/',
    NODE_ENV: 'development',
    AUTH_SPOOFED: true,
}

Does my configuration file gets modified?

No.

Development

If 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:

  1. Fork this repo.
  2. Clone your forked repo.
  3. Create a feature branch with: git checkout develop; git checkout -b feature/<name-of-feature>.
  4. Create a pull request to be merged into develop branch.

💁 Please, do not submit PR to be merged into master branch.

Roadmap

💁 Do you want to suggest a feature? Add a suggestion.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].