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

# Interface: Config

The `Config` is the configuration that `rspeedy` uses.

## Properties

### dev?

> `optional` **dev?**: [`Dev`](/next/api/packages/rspeedy/interfaces/Dev.md)

The [Dev](/next/api/packages/rspeedy/interfaces/Dev.md) option is used to control the behavior related with development. Including: HMR, DevServer, etc.

#### Default Value

```ts
undefined
```

***

### environments?

> `optional` **environments?**: `Record`\<`string`, `EnvironmentConfig`>

**`Lynx Default Changed`**

The [Config.environments](#environments) option is used to set the output environment.

#### Default Value

When this option is unset, Rspeedy passes `{ lynx: {} }` to Rsbuild.

#### Remarks

Normally you don't need this if you are not using Lynx for Web.

#### Examples

- Using different entries for Lynx and Web.

```ts
import { defineConfig } from '@lynx-js/rspeedy'

export default defineConfig({
  environments: {
    lynx: {},
    web: {
      source: { entry: { web: './src/index.web.jsx' } },
    },
  },
  source: {
    entry: './src/index.jsx',
  },
})
```

- Building Web-only outputs.

```ts
import { defineConfig } from '@lynx-js/rspeedy'

export default defineConfig({
  environments: {
    web: {
      source: { entry: { web: './src/index.web.jsx' } },
    },
  },
})
```

***

### mode?

> `optional` **mode?**: `"none"` | `"development"` | `"production"`

Specify the build mode for Rsbuild and Rspack, as each mode has different default behavior and optimizations.

#### Default Value

Depends on `process.env.NODE_ENV`:

- `'production'` when `NODE_ENV` is `'production'`
- `'development'` when `NODE_ENV` is `'development'`
- `'none'` otherwise

With Rspeedy's CLI, `rspeedy dev` and `rspeedy preview` default to `'development'`, and `rspeedy build` defaults to `'production'`.

#### Examples

```ts
If the value of `mode` is `'development'`:

- Enable HMR and register the {@link https://rspack.rs/plugins/webpack/hot-module-replacement-plugin | HotModuleReplacementPlugin}.

- Generate JavaScript and CSS source maps. In Lynx environments, all `.map` assets are removed before emit. See {@link Output.sourceMap} for details.

- The `process.env.NODE_ENV` in the source code will be replaced with `'development'`.

- The `import.meta.env.MODE` in the source code will be replaced with `'development'`.

- The `import.meta.env.DEV` in the source code will be replaced with `true`.

- The `import.meta.env.PROD` in the source code will be replaced with `false`.
```

```ts
If the value of `mode` is `'production'`:

- Enable JavaScript code minification and register the {@link https://rspack.rs/plugins/rspack/swc-js-minimizer-rspack-plugin | SwcJsMinimizerRspackPlugin}.

- Generated JavaScript and CSS filenames will have hash suffixes, see {@link Output.filenameHash}.

- Generated CSS Modules classnames will be shorter, see {@link CssModules.localIdentName}.

- Generate JavaScript and CSS source maps. In Lynx environments, all `.map` assets are removed before emit. See {@link Output.sourceMap}.

- The `process.env.NODE_ENV` in the source code will be replaced with `'production'`.

- The `import.meta.env.MODE` in the source code will be replaced with `'production'`.

- The `import.meta.env.DEV` in the source code will be replaced with `false`.

- The `import.meta.env.PROD` in the source code will be replaced with `true`.
```

***

### output?

> `optional` **output?**: [`Output`](/next/api/packages/rspeedy/interfaces/Output.md)

The [Output](/next/api/packages/rspeedy/interfaces/Output.md) option is used to set how and where should the bundles and assets output.

#### Default Value

```ts
undefined
```

***

### performance?

> `optional` **performance?**: [`Performance`](/next/api/packages/rspeedy/interfaces/Performance.md)

The [Performance](/next/api/packages/rspeedy/interfaces/Performance.md) option is used to optimize the build-time and runtime performance.

#### Default Value

```ts
undefined
```

***

### plugins?

> `optional` **plugins?**: `RsbuildPlugins`

The `plugins` option is used to customize the build process in a variety of ways.

#### Default Value

```ts
undefined
```

#### Remarks

Rspeedy uses the plugin APIs from [Rsbuild](https://rsbuild.rs/plugins/dev/index). See the corresponding document for developing a plugin.

***

### resolve?

> `optional` **resolve?**: [`Resolve`](/next/api/packages/rspeedy/interfaces/Resolve.md)

The [Resolve](/next/api/packages/rspeedy/interfaces/Resolve.md) option is used to control the resolution behavior of Rspack.

#### Default Value

```ts
undefined
```

***

### server?

> `optional` **server?**: [`Server`](/next/api/packages/rspeedy/interfaces/Server.md)

The [Server](/next/api/packages/rspeedy/interfaces/Server.md) option changes the behavior of dev-server.

#### Default Value

```ts
undefined
```

***

### source?

> `optional` **source?**: [`Source`](/next/api/packages/rspeedy/interfaces/Source.md)

The [Source](/next/api/packages/rspeedy/interfaces/Source.md) option changes the behavior of source files.

#### Default Value

```ts
undefined
```

***

### splitChunks?

> `optional` **splitChunks?**: `false` | `SplitChunksConfig`

Configure chunk splitting.

#### Default Value

Rspeedy defaults this to `false`; if configured, Rsbuild handles it with its top-level `splitChunks` option.

#### Remarks

See [Rsbuild - splitChunks](https://rsbuild.rs/config/split-chunks) for details.

***

### tools?

> `optional` **tools?**: [`Tools`](/next/api/packages/rspeedy/interfaces/Tools.md)

The [Tools](/next/api/packages/rspeedy/interfaces/Tools.md) options changes the behavior of various building tools.

#### Default Value

```ts
undefined
```
