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