Webpack configuration manager
Last updated 2 months ago by thealgorithm .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install webpacker 
SYNC missed versions from official npm registry.


Build Status Coverage Status


Webpack configuration manager

But why?

Setting up webpack with a bunch of plugins and environments every time you start a new project can be time consuming and often confusing. Webpacker aims to provide you with an easy way to use standard webpack configurations without the hassle of setting them up yourself all the time.


npm i --save-dev webpacker



For now there are 3 commands you can use.

  • webpacker serve => Webpacker will serve your project for development purposes.
  • webpacker build => Webpacker will build your project and output it to a folder.
  • webpacker stats => Webpacker will build your project and output it to a folder and it will open a browser window with information about your bundle sizes.


Name Additional parameters allowed Description
css {env, postcssOpts} Loads a CSS file
cyclejs {excludePattern, plugins, presets} A functional and reactive JavaScript framework for predictable code. Uses babel-loader
graphql {excludePattern} A query language for your API
react {excludePattern, plugins, presets} A JavaScript library for building user interfaces. Uses babel-loader
scss {env, scssVariables, postcssOpts} Loads a Sass/SCSS file and compiles it to CSS.
utils {env, postcssOpts} An aggregation of postcss-loader, url-loader and style-loader


Name Additional parameters allowed Description
configure {env, constants} Shorthand for using the DefinePlugin on process.env keys.
copy {copy} Copies individual files or entire directories to the build directory
css {devServer} It creates a CSS file per JS file which contains CSS. It supports On-Demand-Loading of CSS and SourceMaps.
favicon {cwd, logo} Allows to use the favicons generator with webpack
html {cwd, index} Plugin that simplifies creation of HTML files to serve your bundles
stats Visualize size of webpack output files with an interactive zoomable treemap
compress {devServer} Prepare compressed versions of assets
lodash opts Treeshaking plugin for lodash-es


To provide configuration to webpacker, you'll need to add a .webpacker.js file in the root of your project. The location of the config file can be changed by passing --config path/to/my/file.js when running webpacker.

The .webpacker.js file needs to export an object with at least the preset key.


The preset defines which loaders and plugins will be used. If the loader or plugin you need is not available, please submit an issue or a PR.

To provide a consistent way of providing arguments to the loaders and plugins, 2 functions are available to help: setLoader and setPlugin.

These functions can be called with the name of the plugin/loader as the first argument and with optional additional arguments as the second.

For a list of available loaders, please check ./loaders/index.js. For a list of available plugins, please check ./plugins/index.js.

Other options

The following options can be adjusted by returning them as a key in .webpacker.js. The options should be functions and their only argument is the function that webpacker itself uses internally. You can choose to call this given function and extend on its return value, or choose to not use the function and return a value of your choosing (refer to the documentation of each option to see what has to be returned).


devServer is used to define options for webpack-dev-server, which is used when running webpacker serve.


entry is for webpack's entry option. By default its value is ./src/index.js.


output is for webpack's output option.


devtool is for webpack's devtool option.

Example file

const path = require('path');
const {setLoader, setPlugin} = require('webpacker/utils');
const constants = require(`./config/${process.env.NODE_ENV || 'development'}`);

module.exports = {
  output: fn => fn({path: path.join(__dirname, 'build')}),
  preset: {
    loaders: [
    plugins: [
      setPlugin('configure', {constants}),
      setPlugin('favicon', {logo: './public/img/streamline.svg'}),


Help us

Support us by giving feedback, opening a pull request or just by starring the project!



Current Tags

  • 4.4.0                                ...           latest (2 months ago)

25 Versions

  • 4.4.0                                ...           2 months ago
  • 4.3.0                                ...           3 months ago
  • 4.2.3                                ...           5 months ago
  • 4.2.2                                ...           7 months ago
  • 4.2.1                                ...           7 months ago
  • 4.2.0                                ...           7 months ago
  • 4.1.2                                ...           8 months ago
  • 4.1.1                                ...           8 months ago
  • 4.1.0                                ...           9 months ago
  • 4.0.2                                ...           10 months ago
  • 4.0.1                                ...           10 months ago
  • 4.0.0                                ...           10 months ago
  • 3.3.0                                ...           10 months ago
  • 3.2.0                                ...           10 months ago
  • 3.1.3                                ...           a year ago
  • 3.1.2                                ...           a year ago
  • 3.1.1                                ...           a year ago
  • 3.1.0 [deprecated]           ...           a year ago
  • 3.0.0 [deprecated]           ...           a year ago
  • 2.1.0 [deprecated]           ...           a year ago
  • 2.0.0 [deprecated]           ...           a year ago
  • 0.0.3 [deprecated]           ...           3 years ago
  • 0.0.2 [deprecated]           ...           3 years ago
  • 0.0.1 [deprecated]           ...           3 years ago
  • 1.0.0 [deprecated]           ...           3 years ago
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 28
Dev Dependencies (16)
Dependents (2)

Copyright 2014 - 2017 © taobao.org |