> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.

# sourceBuild

- **Type:** `boolean | PluginSourceBuildOptions`
- **Default:** `false`

Used to enable the ability for source code building. When this configuration option is enabled, Modern.js will read the source code files corresponding to the `source` field in the sub-project's package.json and compile them.

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

More detail can see ["Source Code Build Mode"](https://modernjs.dev/en/guides/advanced-features/source-build.html)。

### Options

`experiments.sourceBuild` is implemented based on [@rsbuild/plugin-source-build](https://github.com/rstackjs/rsbuild-plugin-source-build?tab=readme-ov-file#options). You can pass plugin options like this:

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