---
url: /reference/Function.filterVitePlugins.md
---
# Function: filterVitePlugins()

* **Exported from**: `rolldown/filter`
* **Type**: (`plugins`: `false` | `T` | `T`\[] | `null` | `undefined`) => `T`\[]

Filters out Vite plugins that have `apply: 'serve'` set.

Since Rolldown operates in build mode, plugins marked with `apply: 'serve'`
are intended only for Vite's dev server and should be excluded from the build process.

## Type Parameters

### T

`T` = `any`

## Parameters

### plugins

`false` | `T` | `T`\[] | `null` | `undefined`

Array of plugins (can include nested arrays)

## Returns

`T`\[]

Filtered array with serve-only plugins removed

## Example

```ts
import { defineConfig } from 'rolldown';
import { filterVitePlugins } from '@rolldown/pluginutils';
import viteReact from '@vitejs/plugin-react';

export default defineConfig({
  plugins: filterVitePlugins([
    viteReact(),
    {
      name: 'dev-only',
      apply: 'serve', // This will be filtered out
      // ...
    }
  ])
});
```
