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/source/include.md.
  • 简体中文
  • source.include

    const defaultInclude = [
      [{ not: /[\\/]node_modules[\\/]/ }, /\.(?:ts|tsx|jsx|mts|cts)$/],
    ];

    source.include 用于指定额外需要编译的 JavaScript 文件。默认情况下,会编译以下文件:

    • 任意目录下的 TypeScript 和 JSX 文件,匹配的文件后缀为 .ts、.tsx、.jsx、.mts、.cts。
    • 非 node_modules 目录下的 JavaScript 文件,匹配的文件后缀为 .js、.mjs、.cjs。
    Tip

    在 Rsbuild 1.4 版本前,source.include 的默认值为:

    const defaultInclude = [
      [
        {
          and: [APP_ROOT, { not: /[\\/]node_modules[\\/]/ }],
        },
        /\.(?:ts|tsx|jsx|mts|cts)$/,
      ],
    ];

    与新版本的差异是,非当前项目目录的 .js、.mjs、.cjs 文件不会被编译。

    Info

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