Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c3e5f11

Browse files
mohitkum4rdanielroe
authored andcommitted
docs: document vite client and server options (#35090)
1 parent 54f7668 commit c3e5f11

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

docs/4.api/6.nuxt-config.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1604,9 +1604,47 @@ export default defineNuxtConfig({
16041604

16051605
Configuration that will be passed directly to Vite.
16061606

1607+
Top-level `vite` options are shared across both client and server environments. Use `$client` and `$server` to provide environment-specific configuration that will be merged into their respective builds.
1608+
1609+
**Example**:
1610+
```ts
1611+
export default defineNuxtConfig({
1612+
vite: {
1613+
$client: {
1614+
build: {
1615+
rollupOptions: {
1616+
output: {
1617+
manualChunks: {
1618+
analytics: ['analytics-package'],
1619+
},
1620+
},
1621+
},
1622+
},
1623+
},
1624+
$server: {
1625+
build: {
1626+
sourcemap: 'inline',
1627+
},
1628+
},
1629+
},
1630+
})
1631+
```
1632+
16071633
**See**: [Vite configuration docs](https://vite.dev/config/) for more information.
16081634
Please note that not all vite options are supported in Nuxt.
16091635

1636+
### `$client`
1637+
1638+
Configuration that will be merged into Vite's configuration for the client (browser) build.
1639+
1640+
- **Type**: `object`
1641+
1642+
### `$server`
1643+
1644+
Configuration that will be merged into Vite's configuration for the server build.
1645+
1646+
- **Type**: `object`
1647+
16101648
### `build`
16111649

16121650
#### `assetsDir`

0 commit comments

Comments
 (0)