webpack-config

raw JSON →
7.5.0 verified Sat Apr 25 auth: no javascript maintenance

Helps to load, extend, and merge webpack configurations. Current stable version is 7.5.0, released October 2017. Last release was v7.5.0. The package provides a chainable API with `extend()`, `merge()`, and `defaults()` methods supporting environment variables and shareable configs via npm. It is maintained by Fitbit, released under Apache-2.0. Key differentiator: simplifies composing multiple webpack config files with merge semantics and variable interpolation. Be aware: the package has been in maintenance mode since 2017 and may not be actively updated; webpack 2+ compatibility is supported but the API was revamped in v7.0.0.

error TypeError: Config is not a constructor
cause Using CommonJS require incorrectly: const Config = require('webpack-config'); // returns the module object, not default.
fix
const Config = require('webpack-config').default; or use ES modules: import Config from 'webpack-config';
error Cannot find module 'recursive-iterator'
cause Missing dependency; recursive-iterator is a peer dependency not installed automatically.
fix
npm install recursive-iterator -D or check your node_modules.
error webpack-config: environment is not a function
cause Calling environment() instead of importing the named export or accessing static methods.
fix
Import as named: import { environment } from 'webpack-config'; then use environment.setAll().
error Invalid configuration object. webpack.js uses the old configuration structure.
cause Using webpack 2+ config format with outdated webpack-config merge semantics.
fix
Ensure your merged config objects use the new webpack 2+ syntax (e.g., rules instead of loaders).
error Error: Cannot find module 'webpack-config-mdreizin/base'
cause Shareable config not installed or the name is incorrect; extend() expects the full package name without prefix if it doesn't start with 'webpack-config-'.
fix
Install the shareable config: npm install webpack-config-mdreizin -D. Then use extend('mdreizin/base') or extend('webpack-config-mdreizin/base').
breaking v7.0.0 introduced a new simple API; previously exposed internal classes and instances are now really internal.
fix Update imports to use the new Config class and named exports. Check the changelog for migration details.
deprecated The package is no longer actively maintained; last release was 2017.
fix Consider migrating to webpack-merge or using webpack's built-in function-based config syntax.
gotcha The `environment` static method expects a function as value; if you pass a literal, it will be evaluated once at config creation time, not per call.
fix Use functions: environment.setAll({ env: () => process.env.NODE_ENV })
gotcha Extending with a shareable config requires the package name to start with 'webpack-config-' prefix, but when using extend('myconfig') the prefix is automatically added unless you specify the full name.
fix If your shareable config is named 'webpack-config-myconfig', you can use extend('myconfig'). To avoid prefix, use the full name: extend('webpack-config-myconfig').
deprecated Node.js engine requirement >=6.0.0, may not work on older versions.
fix Use Node 6+ or consider an alternative.
npm install webpack-config
yarn add webpack-config
pnpm add webpack-config

Shows how to define a base config and extend it with environment-specific overrides using webpack-config's extend and merge methods.

// webpack.config.js
import Config from 'webpack-config';

export default new Config().extend('webpack.config.base.js').merge({
  entry: './src/index.js'
});

// webpack.config.base.js
import Config from 'webpack-config';

export default new Config().merge({
  output: {
    filename: 'bundle.js',
    path: __dirname + '/dist'
  },
  module: {
    loaders: [{
      test: /\.js$/,
      loader: 'babel-loader',
      exclude: /node_modules/
    }]
  }
});