Rspack Config CLI
raw JSON → 1.0.0 verified Sat May 09 auth: no javascript
rspack-config-cli v1.0.0 is a CLI tool to generate, validate, and manage Rspack bundler configurations. It provides template-based generation (minimal, standard, advanced), validation, environment-aware settings, diff comparisons, and configuration modification via CLI commands. Designed as a lightweight alternative to manual configuration with zero runtime dependencies beyond commander and chalk. Released with active maintenance.
Common errors
error Error: Cannot find module 'commander' ↓
cause Local install without dependencies (e.g., npm install --production skips peer dependencies).
fix
Install with dependencies: npm install rspack-config-cli --save-dev
error Error: The template 'advanced' is not supported in this version. ↓
cause Using --template advanced v1.0.0 which only supports minimal and standard.
fix
Upgrade to v1.1.0 or later, or use --template standard instead.
error TypeError: Cannot read properties of undefined (reading 'split') ↓
cause Passing invalid JSON value to 'set' command (e.g., unquoted string).
fix
Use correct JSON syntax: rspack-config set settings.debug true (no quotes for boolean) or rspack-config set settings.logLevel "warn" (escape quotes or use single-quoted strings in shell).
Warnings
breaking v1.0.0 is initial stable release; breaking changes may occur before v2. ↓
fix Pin to exact version and review changelog before upgrading.
gotcha Global install with -g may require sudo on macOS/Linux; prefer npx. ↓
fix Use npx rspack-config init instead of npm install -g rspack-config-cli && rspack-config init.
gotcha Config file path defaults to rspack.config.js in current directory; may overwrite existing files. ↓
fix Always use --output to specify a unique path, especially when experimenting.
deprecated The 'minimal' template is considered deprecated in favor of 'standard' from v1.1.0 onward. ↓
fix Use --template standard instead of minimal.
Install
npm install rspack-config-cli yarn add rspack-config-cli pnpm add rspack-config-cli Imports
- CLI entry wrong
node node_modules/.bin/rspack-config-cli initcorrectnpx rspack-config init - Programmatic usage wrong
import { initConfig } from 'rspack-config-cli';correctconst { initConfig, validateConfig, showConfig, setConfig, diffConfig, listTemplates } = require('rspack-config-cli'); - Types (TypeScript) wrong
import { ConfigOptions } from 'rspack-config-cli';correct// No exported types; use inline JSDoc or custom typings
Quickstart
// Install globally
npm install -g rspack-config-cli
# Initialize a standard config
rspack-config init --template standard --output rspack.config.js
# Validate the generated config
rspack-config validate rspack.config.js
# Set a production mode
rspack-config set mode production
# Show config as JSON
rspack-config show --json --env production
# Compare dev vs prod configs
rspack-config diff rspack.config.dev.js rspack.config.prod.js
# List available templates
rspack-config templates