For AI agents: the complete documentation index is available at /zh/llms.txt, the full documentation bundle is available at /zh/llms-full.txt, and this page is available as Markdown at /zh/configure/app/tools/bundler-chain.md.
  • 简体中文
  • tools.bundlerChain

    • 类型:
    type BundlerChainFn = (
      chain: RspackChain,
      utils: ModifyBundlerChainUtils,
    ) => Promise<void> | void;
    • 默认值: undefined

    你可以通过 tools.bundlerChain 来修改默认的 Rspack 配置,它的值为 Function 类型,接收两个参数:

    • 第一个参数为 bundler-chain 对象实例,你可以通过这个实例来修改 Rspack 的配置。
    • 第二个参数为一个工具集合,包括env、isProd、CHAIN_ID 等。
    什么是 BundlerChain

    Bundler chain 是基于 Rspack 配置 API 实现的链式配置工具,你可以用它来修改 Rspack 的配置。

    通过 bundler chain 修改的配置,将在 Rspack 构建时生效。

    tools.bundlerChain 的执行时机早于 tools.rspack,因此会被 tools.rspack 中的修改所覆盖。

    更多信息可参考 Rsbuild#tools.bundlerChain。