federation
- Type:
boolean - Default:
false - CLI:
--federation
Whether to enable Module Federation support.
Rstest supports Module Federation in both Node Mode (including DOM-simulated environments such as jsdom) and Browser Mode.
When enabled, Rstest installs runtime shims in the test worker so that a Module Federation runtime can load remote entries and chunks through Rstest's module loader while module mocks stay effective.
Testing a federated app
federation only turns on Rstest's test runtime support; it does not configure remotes, exposes, or shared modules. When you use @module-federation/rstest, the plugin configures the Module Federation build and automatically enables Rstest's compatibility mode for Node-based test environments, so you do not need to set federation: true again there.
Start with the Module Federation guide for installation and the Rstest testing workflow. See the official Rstest integration guide for reusing an Rsbuild federation configuration and the complete plugin options.
This Node-based example consumes a Node-targeted remoteEntry.cjs. Browser Mode should consume the browser build's remoteEntry.js. See the Module Federation guide for the distinction and the Node and Browser examples for complete setups.