What problem does it solve?
Provides authoritative, project-safe patterns for customizing Rspack configuration inside Rsbuild/Rslib workflows to avoid common pitfalls like duplicate runtimes, broken Module Federation identifiers, and accidental global config files.
Core Features & Use Cases
- Alias and Loader Overrides: Safely add or override resolve.alias and module.rules from tools.rspack callbacks without overwriting existing nested objects.
- Plugin Management: Show how to access built-in rspack plugins via the callback argument and add IgnorePlugin instances to exclude test files.
- Module Federation Guidance: Prescribes pluginModuleFederation usage at the Rsbuild level, enforces underscore remote names, and mandates singleton Preact sharing to prevent runtime and hooks issues.
- Use Case: Swap a production module for a local mock via resolve.alias and add a rule to inline SVG assets while keeping the rest of the Rspack config intact.
Quick Start
Edit your rsbuild.config.ts or rslib.config.ts and add a tools.rspack callback that safely initializes nested config paths (using ??= or ||=) and mutates resolve.alias, module.rules, or plugins as needed.