webpack-configurator

raw JSON →
0.3.1 verified Sat Apr 25 auth: no javascript deprecated

A helper library for creating and extending Webpack configuration structures (v0.3.1, last release 2015). It provides methods to merge configs, add/remove loaders and plugins with key-based differentiation, and use resolvers for final transformations. Key differentiators include support for function-based merging, pre/post loader management, and plugin removal. However, it is outdated and incompatible with Webpack 2+ due to breaking API changes. No known recent development.

error Cannot find module 'webpack-configurator'
cause Package is not installed or npm install failed.
fix
Run: npm install webpack-configurator@0.3.1
error config.plugin is not a function
cause Using an incompatible version (pre-v0.0.2) or wrong import method.
fix
Ensure package version >=0.0.2 and import the default export correctly.
error TypeError: config.merge is not a function
cause Incorrect import: using named import instead of default.
fix
Use 'import configure from 'webpack-configurator'' then call configure().merge()
deprecated This package is unmaintained and only compatible with Webpack 1.x. Webpack 2+ has breaking changes (e.g., module.rules instead of module.loaders).
fix Use webpack-merge or manual config composition for modern Webpack.
gotcha The .plugin() method expects an object with a 'plugin' key (the constructor), not an instance. Passing an instance may cause unexpected behavior.
fix Use { plugin: PluginConstructor } instead of new PluginConstructor().
gotcha When merging with a function, you must return the modified config object. Forgetting to return will result in undefined.
fix Always return the config object from merge functions.
npm install webpack-configurator
yarn add webpack-configurator
pnpm add webpack-configurator

Demonstrates creating a configurator, merging config, adding loaders and plugins, removing loaders, and resolving the final Webpack configuration.

import configure from 'webpack-configurator';

const config = configure();

// Merge base config
config.merge({
  entry: './src/index.js',
  output: { path: __dirname + '/dist', filename: 'bundle.js' }
});

// Add a loader
config.loader('babel', {
  test: /\.js$/,
  exclude: /node_modules/,
  loader: 'babel-loader'
});

// Add a plugin
config.plugin('uglify', { plugin: require('webpack').optimize.UglifyJsPlugin });

// Remove a loader
config.removeLoader('babel');

// Resolve final config
const webpackConfig = config.resolve();
console.log(webpackConfig);