From f1232cb6ce700ca3bc534b48f5d6aa7c252aa5ce Mon Sep 17 00:00:00 2001 From: undermoon Date: Fri, 26 Jan 2024 01:19:09 +0800 Subject: [PATCH] fix(plugin-legacy): modernTargets when `renderLegacyChunks: false` --- packages/plugin-legacy/src/index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/plugin-legacy/src/index.ts b/packages/plugin-legacy/src/index.ts index d7f0bb206547aa..32daa8e3bd1afc 100644 --- a/packages/plugin-legacy/src/index.ts +++ b/packages/plugin-legacy/src/index.ts @@ -411,7 +411,11 @@ function viteLegacyPlugin(options: Options = {}): Plugin[] { genModern ) { // analyze and record modern polyfills - await detectPolyfills(raw, modernTargets, modernPolyfills) + await detectPolyfills( + raw, + options.modernTargets || modernTargetsBabel, + modernPolyfills, + ) } const ms = new MagicString(raw)