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

# source

Options for input source code.

## source.assetsInclude [![source.assetsInclude](https://assets.rspack.rs/rsbuild/rsbuild-logo.svg)source.assetsInclude](https://rsbuild.rs/config/source/assets-include)
Include additional files that should be treated as static assets.

## source.decorators [![source.decorators](https://assets.rspack.rs/rsbuild/rsbuild-logo.svg)source.decorators](https://rsbuild.rs/config/source/decorators)
Used to configure the decorators syntax.

If [experimentalDecorators](https://www.typescriptlang.org/tsconfig/#experimentalDecorators) is enabled in `tsconfig.json`, Rslib will set `source.decorators.version` to `legacy` by default.

## source.define [![source.define](https://assets.rspack.rs/rsbuild/rsbuild-logo.svg)source.define](https://rsbuild.rs/config/source/define)
Replaces variables in your code with other values or expressions at compile time. This can be useful for injecting env variables and other information to the code during build time.

## source.entry [![source.entry](https://assets.rspack.rs/rsbuild/rsbuild-logo.svg)source.entry](https://rsbuild.rs/config/source/entry)
- **CLI:** `--entry <path>` (repeatable, e.g., `--entry index=src/index.ts` or `--entry src/index.ts`)

  The CLI argument supports two formats:

  1. `key=value`: Explicitly specify the entry name, e.g., `--entry main=src/main.ts`.
  2. `value`: Only specify the path, in which case the basename of the file (without extension) will be automatically used as the entry name. For example, `--entry src/index.ts` will generate an entry named `index`. If there are name conflicts, numeric suffixes (starting from 0) will be added to all conflicting entries, e.g., `index0`, `index1`.

Used to set the entry modules for building.

In Rslib, the default value is:

- bundle mode:

```ts
const defaultEntry = {
  // default support for other suffixes such as ts, tsx, jsx, mjs, cjs
  index: 'src/index.js',
};
```

- bundleless mode:

```ts
const defaultEntry = {
  index: 'src/**',
};
```

:::info
Check out the [lib.bundle](/config/lib/bundle.md#set-entry) to learn more about how to set entry for bundle and bundleless project.
:::

## source.exclude [![source.exclude](https://assets.rspack.rs/rsbuild/rsbuild-logo.svg)source.exclude](https://rsbuild.rs/config/source/exclude)
Exclude JavaScript or TypeScript files that do not need to be transformed by [SWC](https://rsbuild.rs/guide/configuration/swc).

::: note

Files configured in `source.exclude` will not be transformed by SWC, but the referenced files will still be bundled into the outputs.

If you want certain files not to be bundled into the outputs, you can use the following methods:

- **bundle mode**: Use Rspack's [IgnorePlugin](https://rspack.rs/plugins/webpack/ignore-plugin).
- **bundleless mode**: Use `source.entry` to configure the corresponding glob expression, refer to [Set entry](/config/lib/bundle.md#bundle-false).

:::

## source.include [![source.include](https://assets.rspack.rs/rsbuild/rsbuild-logo.svg)source.include](https://rsbuild.rs/config/source/include)
Specify additional JavaScript files that need to be compiled.



## source.transformImport [![source.transformImport](https://assets.rspack.rs/rsbuild/rsbuild-logo.svg)source.transformImport](https://rsbuild.rs/config/source/transform-import)
Transform the import path, which can be used to modularly import the subpath of third-party packages. The functionality is similar to [babel-plugin-import](https://npmjs.com/package/babel-plugin-import).

## source.tsconfigPath [![source.tsconfigPath](https://assets.rspack.rs/rsbuild/rsbuild-logo.svg)source.tsconfigPath](https://rsbuild.rs/config/source/tsconfig-path)
- **CLI:** `--tsconfig <path>` (e.g. `--tsconfig tsconfig.build.json`)

Configure a custom `tsconfig.json` file path to use, can be a relative or absolute path.

The `tsconfig.json` configuration file affects the following behavior of Rslib:

- The `paths` field is used to configure [Path alias](/config/rsbuild/resolve.md#resolvealias).
- The `experimentalDecorators` field is used to configure [Decorators version](/config/rsbuild/source.md#sourcedecorators).
- Used to configure the effective scope, rules, and output directory during [TypeScript declaration file generation](/config/lib/dts.md).
