From a1d307bb05227cc74dcda8b6db304f952b4123bc Mon Sep 17 00:00:00 2001 From: Alexandre Geissmann Date: Thu, 29 Jul 2021 08:45:44 -0400 Subject: [PATCH] fix(legacy): bake-in Promise polyfill (fixes #4414) --- packages/plugin-legacy/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/plugin-legacy/index.js b/packages/plugin-legacy/index.js index 0e9f0eec0803a8..c91286befdd216 100644 --- a/packages/plugin-legacy/index.js +++ b/packages/plugin-legacy/index.js @@ -44,7 +44,12 @@ function viteLegacyPlugin(options = {}) { const facadeToLegacyPolyfillMap = new Map() const facadeToModernPolyfillMap = new Map() const modernPolyfills = new Set() - const legacyPolyfills = 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) if (Array.isArray(options.modernPolyfills)) { options.modernPolyfills.forEach((i) => {