Rspack CLI

The official command-line interface for running Rspack builds, dev servers, and previews.

Tool
npm
v2.2.9
12,952 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
91 /100 Excellent
Development Activity 100
Maintenance 100
Community 68
Maturity 56
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
83 /100 Excellent
Architecture 84
Code Quality 80
Innovation 78
Learning Curve 88

@rspack/cli is the official command-line interface for Rspack, the Rust-based web bundler built as a near drop-in replacement for webpack. It provides the rspack binary with build, serve, and preview commands, wrapping @rspack/core’s compiler API behind a small, webpack-cli-compatible surface so existing webpack projects can adopt Rspack with minimal script changes.

Under the hood it resolves and merges rspack.config.* files (including TypeScript configs via jiti, and multi-config extends chains), applies CLI-flag overrides for entry, output, mode, devtool, and watch mode, and wires the optional @rspack/dev-server peer dependency into the serve/preview commands for local development with HMR. It’s maintained as part of the Rspack monorepo alongside @rspack/core, @rspack/dev-server, and the wider Rstack toolchain (Rsbuild, Rslib, Rspress).

What You Get

  • rspack binary - a single CLI entry point exposing build, serve, and preview commands via the cac argument parser.
  • Flexible config loading - resolves rspack.config.js/ts/mjs automatically, loads TypeScript configs through jiti, and merges extends chains across multiple config files.
  • Dev server integration - serve and preview commands wire in the optional @rspack/dev-server peer dependency for local development with hot module replacement.
  • Stats and JSON output - build results print human-readable stats by default or stream JSON stats (via @discoveryjs/json-ext) to stdout or a file for CI tooling.
  • Multi-compiler support - accepts array/multi configs and CLI --config-name filtering to build only named configurations.

Common Use Cases

  • Migrating a webpack project - swap webpack/webpack-cli scripts for rspack build/rspack serve against a webpack-shaped config with minimal changes.
  • CI production builds - run rspack build --json stats.json in a pipeline and feed the stats file to bundle-analysis or budget-checking tools.
  • Local development with HMR - run rspack serve for a dev server with fast incremental rebuilds powered by the Rust compiler core.
  • Multi-target builds - use an array rspack.config.js with --config-name to build separate client/server or multiple entry configurations from one CLI invocation.

Under The Hood

Architecture

@rspack/cli follows a clean command-pattern architecture: RspackCLI in src/cli.ts owns the cac-based argument parser and registers three pluggable command classes (BuildCommand, ServeCommand, PreviewCommand, each implementing RspackCommand.apply) that wire their own flags and call back into shared orchestration methods (buildCompilerConfig, createCompiler, isWatch). Config resolution is factored into its own layer (utils/loadConfig.ts), which locates rspack.config.* via findConfig, loads it through @rstackjs/load-config/jiti, and recursively resolves extends chains with loadExtendedConfig, merging results via rspack-merge while tracking each contributing file in a WeakMap-based path map later used to seed persistent-cache build dependencies. Options normalization is centralized in utils/options.ts rather than scattered across commands. The abstraction that would break the whole package if it changed is @rspack/core’s rspack() compiler factory and its Compiler/MultiCompiler/Stats types — the CLI is a thin, well-isolated shell around that API, not a reimplementation of bundler logic.

Tech Stack

Written in TypeScript targeting Node ESM, the package uses cac for argument parsing, @rstackjs/load-config plus jiti for loading JS/TS config files without a separate compile step, rspack-merge for config-extends merging, @discoveryjs/json-ext for streaming large stats objects to JSON, and small supporting utilities like exit-hook, concat-stream, and execa. @rspack/core and the optional @rspack/dev-server are peer dependencies, workspace-linked in this monorepo via pnpm’s catalog protocol, keeping the CLI decoupled from a specific compiler build. It ships from a pnpm-workspace monorepo that also houses @rspack/core, create-rspack, and the Rust crates that back the actual compiler.

Code Quality

The tests directory contains an extensive integration test suite covering serve, build, and API surfaces that spins up real CLI processes through a shared test-utils harness and asserts on stdout, including numbered regression tests tied to specific GitHub issues — a strong signal of test-driven regression prevention rather than ad hoc fixes. TypeScript is used throughout with explicit types for CLI options and config shapes; error handling favors typed checks such as instanceof guards over generic catches. The monorepo runs dedicated CI workflows for linting and Rust checks, and enforces formatting conventions for the Rust side it interoperates with, though the CLI package has no dedicated lint config of its own — linting is enforced monorepo-wide rather than per-package.

API Design The public surface is deliberately small and webpack-cli-shaped: three commands (build/b, serve, preview) with familiar flags for config path, config name, environment, watch mode, mode, and devtool, plus a pair of type-only defineConfig/definePlugin helpers exported for config authors. Getting started requires no CLI-specific boilerplate beyond an rspack.config.js — the CLI infers sensible default mode and devtool per command and only overrides config values when a flag is explicitly passed, so existing webpack configs largely work unmodified. Documentation lives centrally on the project’s docs site rather than in the package’s own README, which stays intentionally minimal — install instructions plus a pointer to the required dev-server peer dependency.

Used by 18 apps in this directory

TypeScript
65%
Other

NocoDB

Databases · Low Code Platforms · No Code Platforms

65,340

Turn any SQL database into a collaborative no-code spreadsheet with automatic REST APIs and real-time views.

View details
91
Repo Health
77
Technical
63
Dependency
Built with
TypeScript 65%
Vue 30%
Updated 5 days ago
TypeScript
85%
GPL 3.0

Notesnook

File Storage · Note Taking · Security

14,822

End-to-end encrypted, open-source note-taking where your data stays yours — even from the server.

View details
91
Repo Health
84
Technical
60
Dependency
Built with
TypeScript 85%
JavaScript 12%
Updated 5 days ago
TypeScript
90%
MIT

Plasmic

CMS · Design Tools · Low Code Platforms

7,125

The open-source visual builder that lets teams design React apps and websites with drag-and-drop while integrating seamlessly with your codebase.

View details
81
Repo Health
78
Technical
64
Dependency
Built with
TypeScript 90%
Updated 6 days ago
TypeScript
96%
Other

Refly

AI Development · Automation · No Code Platforms

7,537

Build deterministic, versioned agent skills from natural language—run them anywhere from Claude Code to Slack.

View details
68
Repo Health
76
Technical
63
Dependency
Built with
TypeScript 96%
Updated 1 weeks ago
Python
57%
Other

Sentry

Analytics · Developer Tools · Monitoring

45,632

Developer-first error tracking and performance monitoring platform with AI-powered root-cause analysis across 20+ languages and frameworks.

View details
95
Repo Health
80
Technical
66
Dependency
Built with
Python 57%
TypeScript 42%
Updated 5 days ago
Python
57%
Other

Sentry

Analytics · Developer Tools · Monitoring

45,632

Developer-first error tracking and performance monitoring platform with AI-powered root-cause analysis across 20+ languages and frameworks.

View details
95
Repo Health
80
Technical
66
Dependency
Built with
Python 57%
TypeScript 42%
Updated 5 days ago
TypeScript
98%
MIT

sigle

Blogging

489

A decentralized, open-source writing platform that permanently stores your stories on the Stacks blockchain and Arweave — where Web3 content creators own their words forever.

View details
81
Repo Health
78
Technical
69
Dependency
Built with
TypeScript 98%
Updated 2 weeks ago
TypeScript
98%
MIT

sigle

Blogging

489

A decentralized, open-source writing platform that permanently stores your stories on the Stacks blockchain and Arweave — where Web3 content creators own their words forever.

View details
81
Repo Health
78
Technical
69
Dependency
Built with
TypeScript 98%
Updated 2 weeks ago
TypeScript
87%
Other

Webiny JS

Blogging · CMS · Ecommerce

8,047

Open-source, self-hosted CMS on AWS serverless — a TypeScript framework you extend with code, not a product you configure through a UI.

View details
90
Repo Health
86
Technical
61
Dependency
Built with
TypeScript 87%
JavaScript 12%
Updated 6 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers