webpack-command
raw JSON → 0.5.1 verified Sat Apr 25 auth: no javascript maintenance
webpack-command (v0.5.1) is a lightweight, modular CLI for webpack 4 that provides an enhanced user experience over webpack-cli. It features extendable configurations, custom reporters, support for configs in JSON/YAML/JS, and did-you-mean flag suggestions. Requires Node >=8.9.0 and webpack ^4.4.0. The package is in maintenance mode; the recommended successor is webpack-nano. Key differentiator: significantly smaller package size (24% of webpack-cli) and richer default output via webpack-stylish. Release cadence: irregular, last release 0.5.1.
Common errors
error Error: Cannot find module 'webpack' ↓
cause webpack is not installed or is a devDependency not available globally.
fix
Run
npm install webpack --save-dev and use npx or local node_modules. error Error: webpack-command cannot be installed together with webpack-cli. ↓
cause Both packages export a 'webpack' binary, causing conflicts.
fix
Run
npm uninstall webpack-cli and then install webpack-command. error Error: Unknown argument: --mode ↓
cause The --mode flag is not supported by webpack-command; use --define-process-env-node-env or configuration file.
fix
Set mode in webpack config (module.exports.mode) or use environment variable NODE_ENV.
Warnings
breaking Node v8 minimum: version 0.5.0 dropped support for Node v6. ↓
fix Upgrade Node to >=8.9.0.
deprecated webpack-command is in maintenance mode. The recommended alternative is webpack-nano. ↓
fix Migrate to webpack-nano (https://www.npmjs.com/package/webpack-nano).
gotcha Cannot be installed alongside webpack-cli because both export a 'webpack' binary. ↓
fix Uninstall webpack-cli before installing webpack-command: npm uninstall webpack-cli.
gotcha Requires webpack ^4.4.0; not compatible with webpack 5. ↓
fix Use webpack 4.x or switch to a webpack 5-compatible CLI like webpack-cli.
Install
npm install webpack-command yarn add webpack-command pnpm add webpack-command Imports
- webpack-command (CLI) wrong
webpack --helpcorrectwp --help - Programmatic API (not officially exported) wrong
import webpackCmd from 'webpack-command';correctconst webpackCmd = require('webpack-command'); - Custom reporter
// Implement your own reporter by passing --reporter option
Quickstart
npm install webpack-command webpack --save-dev
# basic usage: wp ./src/index.js --output ./dist/bundle.js