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/html/template-parameters.md.
  • 简体中文
  • html.templateParameters

    • 类型: Record<string, unknown> | Function
    • 默认值:
    type DefaultParameters = {
      mountId: string; // 对应 html.mountId 配置
      entryName: string; // 入口名称
      assetPrefix: string; // 对应 dev.assetPrefix 和 output.assetPrefix 配置
      compilation: Compilation; // Rspack 的 compilation 对象
      rspackConfig: Rspack.Configuration; // Rspack 的配置对象
      // html-rspack-plugin 生成的参数
      htmlPlugin: {
        tags: {
          headTags: HtmlTagObject[];
          bodyTags: HtmlTagObject[];
        };
        files: {
          publicPath: string;
          js: Array<string>;
          css: Array<string>;
          favicon?: string;
        };
      };
    };

    定义 HTML 模板中的参数,对应 html-rspack-plugin 的 templateParameters 配置项。

    Info

    该配置项的使用方式与 Rsbuild 完全一致。详细信息请参考 Rsbuild - html.templateParameters。