Skip to content

Commit

Permalink
refactor(legacy): remove genDynamicFallback variable
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red committed Feb 2, 2023
1 parent 3771b9e commit b451858
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/plugin-legacy/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ function viteLegacyPlugin(options: Options = {}): Plugin[] {
let targets: Options['targets']

const genLegacy = options.renderLegacyChunks !== false
const genDynamicFallback = genLegacy

const debugFlags = (process.env.DEBUG || '').split(',')
const isDebug =
Expand Down Expand Up @@ -247,7 +246,7 @@ function viteLegacyPlugin(options: Options = {}): Plugin[] {
}

// legacy bundle
if (legacyPolyfills.size || genDynamicFallback) {
if (legacyPolyfills.size) {
// check if the target needs Promise polyfill because SystemJS relies on it
// https://github.com/systemjs/systemjs#ie11-support
await detectPolyfills(
Expand Down Expand Up @@ -362,7 +361,7 @@ function viteLegacyPlugin(options: Options = {}): Plugin[] {

const ms = new MagicString(raw)

if (genDynamicFallback && chunk.isEntry) {
if (genLegacy && chunk.isEntry) {
ms.prepend(forceDynamicImportUsage)
}

Expand Down Expand Up @@ -552,7 +551,7 @@ function viteLegacyPlugin(options: Options = {}): Plugin[] {
}

// 5. inject dynamic import fallback entry
if (genDynamicFallback && legacyPolyfillFilename && legacyEntryFilename) {
if (genLegacy && legacyPolyfillFilename && legacyEntryFilename) {
tags.push({
tag: 'script',
attrs: { type: 'module' },
Expand Down

0 comments on commit b451858

Please sign in to comment.