Skip to content
On this page

Beyond Fast

ViteConf 2023

Watch the replay!

SSR Options

ssr.external

Force externalize dependencies for SSR.

ssr.noExternal

  • Type: string | RegExp | (string | RegExp)[] | true
  • Related: SSR Externals

Prevent listed dependencies from being externalized for SSR. If true, no dependencies are externalized.

ssr.target

  • Type: 'node' | 'webworker'
  • Default: node

Build target for the SSR server.

ssr.format

Build format for the SSR server. Since Vite v3 the SSR build generates ESM by default. 'cjs' can be selected to generate a CJS build, but it isn't recommended. The option is left marked as experimental to give users more time to update to ESM. CJS builds require complex externalization heuristics that aren't present in the ESM format.

ssr.resolve.conditions

Defaults to the the root resolve.conditions.

These conditions are used in the plugin pipeline, and only affect non-externalized dependencies during the SSR build. Use ssr.resolve.externalConditions to affect externalized imports.

ssr.resolve.externalConditions

  • Type: string[]
  • Default: []

Conditions that are used during ssr import (including ssrLoadModule) of externalized dependencies.

Released under the MIT License. (aac695e9)