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

    • 类型: boolean | PluginSourceBuildOptions
    • 默认值: false

    用于开启源码构建的能力。当开启此配置项时,Modern.js 会读取子项目 package.json 的 source 字段对应的源码文件,并进行编译。

    export default {
      experiments: {
        sourceBuild: true,
      },
    };

    更多信息可参考「源码构建模式」。

    选项

    experiments.sourceBuild 底层基于 @rsbuild/plugin-source-build 实现,你可以传入插件选项,比如:

    export default {
      experiments: {
        sourceBuild: {
          sourceField: 'my-source',
          resolvePriority: 'output',
        },
      },
    };