diff --git a/packages/plugin-legacy/src/index.ts b/packages/plugin-legacy/src/index.ts index ff6f30685e199a..05e276ca3b1ff8 100644 --- a/packages/plugin-legacy/src/index.ts +++ b/packages/plugin-legacy/src/index.ts @@ -63,12 +63,7 @@ function viteLegacyPlugin(options: Options = {}): Plugin[] { const facadeToLegacyPolyfillMap = new Map() const facadeToModernPolyfillMap = new Map() const modernPolyfills = new Set() - // System JS relies on the Promise interface. It needs to be polyfilled for IE 11. (array.iterator is mandatory for supporting Promise.all) - const DEFAULT_LEGACY_POLYFILL = [ - 'core-js/modules/es.promise', - 'core-js/modules/es.array.iterator' - ] - const legacyPolyfills = new Set(DEFAULT_LEGACY_POLYFILL) + const legacyPolyfills = new Set() if (Array.isArray(options.modernPolyfills)) { options.modernPolyfills.forEach((i) => { @@ -150,11 +145,13 @@ function viteLegacyPlugin(options: Options = {}): Plugin[] { // legacy bundle if (legacyPolyfills.size || genDynamicFallback) { - if (!legacyPolyfills.has('es.promise')) { - // check if the target needs Promise polyfill because SystemJS relies - // on it - await detectPolyfills(`Promise.resolve()`, targets, legacyPolyfills) - } + // check if the target needs Promise polyfill because SystemJS relies on it + // https://github.com/systemjs/systemjs#ie11-support + await detectPolyfills( + `Promise.resolve(); Promise.all();`, + targets, + legacyPolyfills + ) isDebug && console.log(