From 3a51d6c29cb57dcf4cec4ac80a263f7e717fea3e Mon Sep 17 00:00:00 2001 From: Alexandre Bonaventure Geissmann Date: Thu, 29 Jul 2021 09:35:57 -0400 Subject: [PATCH] fix(plugin-legacy): bake-in Promise polyfill, fix #4414 (#4440) --- 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) => {