From 4904370b0b25e9ed61669b46a40980598873a7f9 Mon Sep 17 00:00:00 2001 From: Tal500 Date: Thu, 23 Feb 2023 20:23:21 +0200 Subject: [PATCH 1/2] fix: no build target override on SSR --- packages/plugin-legacy/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/plugin-legacy/src/index.ts b/packages/plugin-legacy/src/index.ts index acb318db988591..e3d28df0403ad4 100644 --- a/packages/plugin-legacy/src/index.ts +++ b/packages/plugin-legacy/src/index.ts @@ -165,7 +165,7 @@ function viteLegacyPlugin(options: Options = {}): Plugin[] { name: 'vite:legacy-config', config(config, env) { - if (env.command === 'build') { + if (env.command === 'build' && config.build?.ssr) { if (!config.build) { config.build = {} } From e74505b657c36cb8ff12b6be6cdf694f79faaba7 Mon Sep 17 00:00:00 2001 From: Tal500 Date: Sat, 25 Feb 2023 18:37:49 +0200 Subject: [PATCH 2/2] Update packages/plugin-legacy/src/index.ts Co-authored-by: Bjorn Lu --- packages/plugin-legacy/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/plugin-legacy/src/index.ts b/packages/plugin-legacy/src/index.ts index e3d28df0403ad4..84453271e65736 100644 --- a/packages/plugin-legacy/src/index.ts +++ b/packages/plugin-legacy/src/index.ts @@ -165,7 +165,7 @@ function viteLegacyPlugin(options: Options = {}): Plugin[] { name: 'vite:legacy-config', config(config, env) { - if (env.command === 'build' && config.build?.ssr) { + if (env.command === 'build' && !config.build?.ssr) { if (!config.build) { config.build = {} }