type BundlerChainFn = (
chain: RspackChain,
utils: ModifyBundlerChainUtils,
) => Promise<void> | void;undefined你可以通过 tools.bundlerChain 来修改默认的 Rspack 配置,它的值为 Function 类型,接收两个参数:
bundler-chain 对象实例,你可以通过这个实例来修改 Rspack 的配置。env、isProd、CHAIN_ID 等。Bundler chain 是基于 Rspack 配置 API 实现的链式配置工具,你可以用它来修改 Rspack 的配置。
通过 bundler chain 修改的配置,将在 Rspack 构建时生效。
tools.bundlerChain的执行时机早于 tools.rspack,因此会被 tools.rspack 中的修改所覆盖。
更多信息可参考 Rsbuild#tools.bundlerChain。