Function | undefined
undefined
You can modify the webpack and Rspack configuration by configuring tools.bundlerChain
which is type of Function
. The function receives two parameters, the first is the original bundler chain object, and the second is an object containing some utils.
Bundler chain is a subset of webpack chain, which contains part of the webpack chain API that you can use to modify both webpack and Rspack configuration.
Configurations modified via bundler chain will work on both webpack and Rspack builds. Note that the bundler chain only supports modifying the configuration of the non-differentiated parts of webpack and Rspack. For example, modifying the devtool configuration option (webpack and Rspack have the same devtool property value type), or adding an Rspack-compatible webpack plugin.
tools.bundlerChain
is executed earlier than tools.webpackChain / tools.webpack / tools.rspack and thus will be overridden by changes in others.
For more information, please refer to Rsbuild#tools.bundlerChain.