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

# Function: defineConfig()

## Call Signature

> **defineConfig**(`config`: [`Config`](/next/api/packages/rspeedy/interfaces/Config.md)): [`Config`](/next/api/packages/rspeedy/interfaces/Config.md)

The `defineConfig` method is a helper function used to get TypeScript intellisense.

### Parameters

| Parameter | Type                                                        | Description            |
| --------- | ----------------------------------------------------------- | ---------------------- |
| `config`  | [`Config`](/next/api/packages/rspeedy/interfaces/Config.md) | The config of Rspeedy. |

### Returns

[`Config`](/next/api/packages/rspeedy/interfaces/Config.md)

The identical config as the input config.

### Example

Use `defineConfig` in `lynx.config.ts`:

```ts
import { defineConfig } from '@lynx-js/rspeedy'
export default defineConfig({
  // autocompletion works here!
})
```

## Call Signature

> **defineConfig**(`config`: (`params`: [`ConfigParams`](/next/api/packages/rspeedy/interfaces/ConfigParams.md)) => [`Config`](/next/api/packages/rspeedy/interfaces/Config.md)): (`params`: [`ConfigParams`](/next/api/packages/rspeedy/interfaces/ConfigParams.md)) => [`Config`](/next/api/packages/rspeedy/interfaces/Config.md)

The `defineConfig` method is a helper function used to get TypeScript intellisense.

### Parameters

| Parameter | Type                                                                                                                                               | Description                                    |
| --------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------- |
| `config`  | (`params`: [`ConfigParams`](/next/api/packages/rspeedy/interfaces/ConfigParams.md)) => [`Config`](/next/api/packages/rspeedy/interfaces/Config.md) | The function that returns a config of Rspeedy. |

### Returns

The identical function as the input.

(`params`: [`ConfigParams`](/next/api/packages/rspeedy/interfaces/ConfigParams.md)) => [`Config`](/next/api/packages/rspeedy/interfaces/Config.md)

### Examples

Use `defineConfig` in `lynx.config.ts`:

```ts
import { defineConfig } from '@lynx-js/rspeedy'
export default defineConfig(() => {
  return {
    // autocompletion works here!
  }
})
```

Use `defineConfig` with parameters in `lynx.config.ts`:

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

export default defineConfig(({ env }) => {
  const isTest = env === 'test'
  return {
    output: {
      minify: isTest ? false : true,
    },
  }
})
```

## Call Signature

> **defineConfig**(`config`: `Promise`\<[`Config`](/next/api/packages/rspeedy/interfaces/Config.md)>): `Promise`\<[`Config`](/next/api/packages/rspeedy/interfaces/Config.md)>

The `defineConfig` method is a helper function used to get TypeScript intellisense.

### Parameters

| Parameter | Type                                                                    | Description                                       |
| --------- | ----------------------------------------------------------------------- | ------------------------------------------------- |
| `config`  | `Promise`\<[`Config`](/next/api/packages/rspeedy/interfaces/Config.md)> | The promise that resolves to a config of Rspeedy. |

### Returns

`Promise`\<[`Config`](/next/api/packages/rspeedy/interfaces/Config.md)>

The identical promise as the input.

### Example

Use `defineConfig` in `lynx.config.ts`:

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

export default defineConfig(
  import('@lynx-js/react-rsbuild-plugin').then(({ pluginReactLynx }) => ({
    plugins: [pluginReactLynx()],
  })),
);
```

## Call Signature

> **defineConfig**(`config`: (`params`: [`ConfigParams`](/next/api/packages/rspeedy/interfaces/ConfigParams.md)) => `Promise`\<[`Config`](/next/api/packages/rspeedy/interfaces/Config.md)>): (`params`: [`ConfigParams`](/next/api/packages/rspeedy/interfaces/ConfigParams.md)) => `Promise`\<[`Config`](/next/api/packages/rspeedy/interfaces/Config.md)>

The `defineConfig` method is a helper function used to get TypeScript intellisense.

### Parameters

| Parameter | Type                                                                                                                                                           | Description                                                               |
| --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| `config`  | (`params`: [`ConfigParams`](/next/api/packages/rspeedy/interfaces/ConfigParams.md)) => `Promise`\<[`Config`](/next/api/packages/rspeedy/interfaces/Config.md)> | The function that returns a promise that resolves to a config of Rspeedy. |

### Returns

The identical function as the input.

(`params`: [`ConfigParams`](/next/api/packages/rspeedy/interfaces/ConfigParams.md)) => `Promise`\<[`Config`](/next/api/packages/rspeedy/interfaces/Config.md)>

### Examples

Use `defineConfig` in `lynx.config.ts`:

```ts
import { defineConfig } from '@lynx-js/rspeedy'
export default defineConfig(async () => {
  const foo = await bar()
  return {
    // autocompletion works here!
  }
})
```

Use `defineConfig` with parameters in `lynx.config.ts`:

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

export default defineConfig(async ({ env }) => {
  const foo = await bar()
  const isTest = env === 'test'
  return {
    output: {
      minify: isTest ? false : true,
    },
  }
})
```
