Skip to content

Commit

Permalink
fix: ssrBuild is optional, avoid breaking VitePress (#8912)
Browse files Browse the repository at this point in the history
  • Loading branch information
patak-dev committed Jul 4, 2022
1 parent 188f188 commit 722f514
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/config/index.md
Expand Up @@ -80,7 +80,7 @@ export default defineConfig(({ command, mode, ssrBuild }) => {

It is important to note that in Vite's API the `command` value is `serve` during dev (in the cli `vite`, `vite dev`, and `vite serve` are aliases), and `build` when building for production (`vite build`).

Only `ssrBuild` is included instead of a more general `ssr` flag because, during dev, the config is shared by the single server handling SSR and non-SSR requests.
`ssrBuild` is experimental. It is only available during build instead of a more general `ssr` flag because, during dev, the config is shared by the single server handling SSR and non-SSR requests. The value could be `undefined` for tools that don't have separate commands for the browser and SSR build, so use explicit comparison against `true` and `false`.

## Async Config

Expand Down
5 changes: 4 additions & 1 deletion packages/vite/src/node/config.ts
Expand Up @@ -66,7 +66,10 @@ export type { RenderBuiltAssetUrl } from './build'
export interface ConfigEnv {
command: 'build' | 'serve'
mode: string
ssrBuild: boolean
/**
* @experimental
*/
ssrBuild?: boolean
}

/**
Expand Down

0 comments on commit 722f514

Please sign in to comment.