parallel-webpack
raw JSON → 2.6.0 verified Sat Apr 25 auth: no javascript
Build multiple webpack configurations in parallel using all CPU cores. Current stable version is 2.6.0 (released 2020), with an alpha 3.0.0 that drops watch mode and switches from worker-farm to jest-worker. Reduces build times dramatically (e.g., from 16 min to 2 min for 32 variants). Key differentiator: built-in createVariants helper for generating configuration combinations without manual config arrays.
Common errors
error Error: Cannot find module 'parallel-webpack' ↓
cause Local install missing or global install not in PATH.
fix
Run
npm install parallel-webpack --save-dev and use npx parallel-webpack. error Error: webpack version mismatch; expected ^1.12.9 || ^2.2.0 || ^3.x || ^4.x but found 5.x ↓
cause Webpack 5 is not in the peer dependency range.
fix
Install webpack 4:
npm install webpack@4 --save-dev. error TypeError: createVariants is not a function ↓
cause Using `require('parallel-webpack')` directly; createVariants is a named export.
fix
Use
const { createVariants } = require('parallel-webpack'); Warnings
breaking v3.0.0-alpha.1 drops watch mode support; use v2.6.x if you need --watch. ↓
fix Stay on v2.6.0 or implement custom watch logic.
breaking v3.0.0-alpha.1 changes worker-farm to jest-worker; may affect error handling and output. ↓
fix Test with your config; upgrade only after validating behavior.
deprecated Webpack 4 support is stable but Webpack 5 is not officially supported. ↓
fix Use webpack 4 or test with webpack 5 at your own risk.
gotcha Config function that returns a promise of config array is only supported since v2.5.0. ↓
fix Update to v2.5.0+ or export a static array.
gotcha Worker processes may not exit cleanly on error; unhandled rejections cause build failure since v2.6.0. ↓
fix Update to v2.6.0+; older versions may hang.
Install
npm install parallel-webpack yarn add parallel-webpack pnpm add parallel-webpack Imports
- createVariants wrong
const createVariants = require('parallel-webpack').createVariants;correctimport { createVariants } from 'parallel-webpack' - default (run CLI) wrong
require('parallel-webpack')()correctparallel-webpack (CLI command) - run (programmatic)
const { run } = require('parallel-webpack'); run(configs, options);
Quickstart
// webpack.config.js
var path = require('path');
module.exports = [{
entry: './pageA.js',
output: {
path: path.resolve(__dirname, './dist'),
filename: 'pageA.bundle.js'
}
}, {
entry: './pageB.js',
output: {
path: path.resolve(__dirname, './dist'),
filename: 'pageB.bundle.js'
}
}];
// CLI: npx parallel-webpack --config webpack.config.js