From d65235df389697740b33c07b20cd764eb0f30323 Mon Sep 17 00:00:00 2001 From: sapphi-red <49056869+sapphi-red@users.noreply.github.com> Date: Tue, 11 Nov 2025 18:55:42 +0900 Subject: [PATCH] fix: don't set `ssr.optimizeDeps.rollupOptions` compat if `ssr` option is not set --- packages/vite/src/node/config.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/vite/src/node/config.ts b/packages/vite/src/node/config.ts index 6abf1a975dd849..3e3ef91ec2b618 100644 --- a/packages/vite/src/node/config.ts +++ b/packages/vite/src/node/config.ts @@ -1301,9 +1301,10 @@ export async function resolveConfig( setupRollupOptionCompat(config.worker) config.optimizeDeps ??= {} setupRollupOptionCompat(config.optimizeDeps) - config.ssr ??= {} - config.ssr.optimizeDeps ??= {} - setupRollupOptionCompat(config.ssr.optimizeDeps) + if (config.ssr) { + config.ssr.optimizeDeps ??= {} + setupRollupOptionCompat(config.ssr.optimizeDeps) + } let configFileDependencies: string[] = [] let mode = inlineConfig.mode || defaultMode