Utilities to help your webpack config be easier to read
The problem
Webpack configuration is a JavaScript object which is awesomely declarative. However, often the webpack config file is
can easily turn into an imperative mess in the process of creating the configuration object.
This solution
The goal of this project is to provide utilities to make it easier to compose your config object so it's easier for
people to read. It has some custom methods and also comes bundled with some other projects to expose some helpful
utility functions.
Installation
This module is distributed via npm which is bundled with node and should
be installed as one of your project's devDependencies:
npm install --save-dev webpack-config-utils
Usage
It is expected that you use this in your webpack.config.js file.
Protip: You can name your config file webpack.config.babel.js and
it'll be automagically transpiled! (Make sure you have
babel-register installed.) So you could use ES6 module imports
rather than CommonJS requires. But this example will stick to
CommonJS because we love you ❤️
Things get even better with webpack 2+ because you can write your webpack config as a function that accepts an env
argument which you can set on the command line (which means you don't need cross-env 👍).
See the API Documentation here. In addition to custom utilities from this package, it comes bundled with
a few another helpful utility: webpack-combine-loaders (exposed as combineLoaders).