rspack build: Rust-Powered webpack Builds
rspack build runs a production build using Rspack, a Rust bundler that mirrors the webpack config API but is much faster.
Rspack aims to be a drop-in for webpack. In CI the commands look familiar: build with a mode and a config, get an optimized bundle in less time.
What it does
rspack build compiles the app per rspack.config.js, which uses the same shape as a webpack config (entry, output, module rules, plugins). It applies production optimizations when --mode production is set.
Common usage
rspack build --mode production
rspack build -c rspack.config.js --mode production
# via the framework wrapper
rsbuild buildOptions
| Flag | What it does |
|---|---|
| --mode <m> | production, development, or none |
| -c, --config <file> | Config file (default rspack.config.js) |
| --env <val> | Value passed to a function config |
| --analyze | Emit a bundle analysis report |
| -w, --watch | Watch mode (not for CI) |
In CI
Pin the @rspack/cli version because it ships a native binary; a version skew across runners can fail to load. Since the config API tracks webpack, most webpack loaders/plugins that Rspack supports work unchanged, but check compatibility for niche plugins.
Common errors in CI
"Module not found: Can't resolve \"X\"" is the same case-sensitivity or missing-dependency issue as webpack, surfacing only on Linux runners. "Failed to load config" means a bad --config path or an ESM/TS config without the right loader. A native load error like "Cannot find module \"@rspack/binding-linux-x64-gnu\"" means a clean install is needed on that OS.