From 081353179a4029d8aedaf3dfd78b95d95b757668 Mon Sep 17 00:00:00 2001 From: Jan Gosmann Date: Fri, 8 Mar 2024 13:36:43 +0100 Subject: [PATCH] fix(plugin-legacy): respect modernTargets option if renderLegacyChunks disabled (#15789) --- packages/plugin-legacy/src/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/plugin-legacy/src/index.ts b/packages/plugin-legacy/src/index.ts index b47d47ffc7801f..c33893420c8ed0 100644 --- a/packages/plugin-legacy/src/index.ts +++ b/packages/plugin-legacy/src/index.ts @@ -331,6 +331,10 @@ function viteLegacyPlugin(options: Options = {}): Plugin[] { } config = _config + modernTargets = options.modernTargets || modernTargetsBabel + isDebug && + console.log(`[@vitejs/plugin-legacy] modernTargets:`, modernTargets) + if (!genLegacy || config.build.ssr) { return } @@ -341,10 +345,6 @@ function viteLegacyPlugin(options: Options = {}): Plugin[] { 'last 2 versions and not dead, > 0.3%, Firefox ESR' isDebug && console.log(`[@vitejs/plugin-legacy] targets:`, targets) - modernTargets = options.modernTargets || modernTargetsBabel - isDebug && - console.log(`[@vitejs/plugin-legacy] modernTargets:`, modernTargets) - const getLegacyOutputFileName = ( fileNames: | string