The purpose of this package is to simplify tedious and complex process of configuring Webpack. It contains typical build pipeline features with default configuration that required in wide range of projects. At the same time it is possible to override or extend existing functionality.
Webpack
Additionally, every feature has its own prerequisites. More about it in Features
To install config builder run:
npm install webpack-config-builder --save-dev
Note that it should be installed as development dependency.
List of supported features and their description
| Feature | Description |
|---|---|
| AutoPrefix | Automatically add browser prefixes to CSS styles based on the list of supported browsers |
| Babel | Add babel transpiler to building pipeline |
| CleanOutputDir | Clean output directory before outputting builded assets |
| CssModules | Enable CSS Modules support for styles |
| DevServer | Enable development server |
| ExtractVendorDependencies | Extract vendor packages to separate bundle |
| GenerateIndex | Generate index.html file based on provided template |
| Json | Add support for .json files |
| MinifyScripts | |
| MinifyStyles | |
| Notify | |
| RuntimeDependencies | |
| SCSS | |
| Statistics | |
| StyleLint | |
| TypeScript | |
| TypeScriptLint |
Automatically add browser prefixes to CSS styles based on provided list of supported browsers. Should be applied after all of the project's style features that require autoprefix (SCSS, CSS etc.)
builder.autoprefix({
supportedBrowsers: [
'last 4 versions',
'Safari >=10',
'ie >= 10'
]
});
| Name | Description |
|---|---|
| supportedBrowsers | List of supported browsers. More |
| postcssLoaderOptions | Any additional configuration to pass to postcss-loader |
Apply Babel JavaScript transpiler to code. Should be applied after all of the project's script feature that require transpiling (TypeScript, JavaScript etc)
- babel-loader Link
builder.babel({
presets: [
["babel-preset-es2015", { "modules": false }],
"babel-preset-stage-2",
"babel-preset-react"
],
plugins: [
"babel-plugin-transform-react-constant-elements",
"babel-plugin-transform-react-inline-elements"
]
});
| Name | Description |
|---|---|
| presets | Array of babel presets. Note that babel-preset-* prefix is required |
| plugins | Array of babel plugins. Note that babel-plugin-* prefix is required |
| babelLoaderOptions | Any additional configuration to pass to babel-loader |
Clean output directory before the build. Should not be used with DevServer feature as it does not output files to the disk.
- clean-webpack-plugin Link
builder.cleanOutputDir();
| Name | Description |
|---|---|
| cleanPluginOptions | Any additional configuration to pass to clean-webpack-plugin |
We use SemVer for versioning. For the versions available, see the tags on this repository.