From 055fa0a8b4e1849490936c8740f2223776a2fc85 Mon Sep 17 00:00:00 2001 From: forehalo Date: Thu, 14 Nov 2024 09:59:01 +0000 Subject: [PATCH] fix(core): polyfill iterator helper for safari (#8824) fix AF-1691 --- packages/frontend/core/src/bootstrap/polyfill/browser.ts | 2 ++ .../core/src/bootstrap/polyfill/iterator-helpers.ts | 7 +++++++ 2 files changed, 9 insertions(+) create mode 100644 packages/frontend/core/src/bootstrap/polyfill/iterator-helpers.ts diff --git a/packages/frontend/core/src/bootstrap/polyfill/browser.ts b/packages/frontend/core/src/bootstrap/polyfill/browser.ts index b84ee578d0..f92ff94f24 100644 --- a/packages/frontend/core/src/bootstrap/polyfill/browser.ts +++ b/packages/frontend/core/src/bootstrap/polyfill/browser.ts @@ -1,4 +1,5 @@ import { polyfillDispose } from './dispose'; +import { polyfillIteratorHelpers } from './iterator-helpers'; import { polyfillPromise } from './promise-with-resolvers'; import { polyfillEventLoop } from './request-idle-callback'; import { polyfillResizeObserver } from './resize-observer'; @@ -7,3 +8,4 @@ polyfillResizeObserver(); polyfillEventLoop(); await polyfillPromise(); await polyfillDispose(); +await polyfillIteratorHelpers(); diff --git a/packages/frontend/core/src/bootstrap/polyfill/iterator-helpers.ts b/packages/frontend/core/src/bootstrap/polyfill/iterator-helpers.ts new file mode 100644 index 0000000000..59ccde6c41 --- /dev/null +++ b/packages/frontend/core/src/bootstrap/polyfill/iterator-helpers.ts @@ -0,0 +1,7 @@ +export async function polyfillIteratorHelpers() { + if (typeof globalThis['Iterator'] !== 'function') { + // @ts-expect-error ignore + // https://github.com/zloirock/core-js/blob/master/packages/core-js/proposals/iterator-helpers-stage-3.js + await import('core-js/proposals/iterator-helpers-stage-3'); + } +}