Skip to content

Commit

Permalink
docs: add example for merging vite config defined as a function (#3978)
Browse files Browse the repository at this point in the history
  • Loading branch information
vinassefranche authored Aug 24, 2023
1 parent e8f7b08 commit 7dac059
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions docs/config/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,21 @@ export default mergeConfig(viteConfig, defineConfig({
`mergeConfig` helper is availabe in Vitest since v0.30.0. You can import it from `vite` directly, if you use lower version.
:::

If your vite config is defined as a function, you can define the config like this:
```ts
import { defineConfig, mergeConfig } from 'vitest/config'
import viteConfig from './vite.config'

export default defineConfig(configEnv => mergeConfig(
viteConfig(configEnv),
defineConfig({
test: {
exclude: ['packages/template/*'],
},
})
))
```

## Options

:::tip
Expand Down

0 comments on commit 7dac059

Please sign in to comment.