From 0d5dc7dfcd9bdfe6c0e78e9f4b1cf0becef7fac0 Mon Sep 17 00:00:00 2001 From: Colin Rotherham Date: Mon, 11 Dec 2023 16:16:45 +0000 Subject: [PATCH] Exclude polyfills for DOM collection iteration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Although these polyfills are required to iterate DOM collections, we always use `Array.from()` so don’t need them: ``` The corejs3 polyfill added the following polyfills: es.array.iterator { "chrome":"61", "opera":"48", "samsung":"8.2" } web.dom-collections.iterator { "chrome":"61", "edge":"16", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" } ``` --- packages/govuk-frontend/babel.config.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/govuk-frontend/babel.config.js b/packages/govuk-frontend/babel.config.js index df42af4099..1121074588 100644 --- a/packages/govuk-frontend/babel.config.js +++ b/packages/govuk-frontend/babel.config.js @@ -53,6 +53,10 @@ module.exports = function (api) { // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause 'es.error.cause', + // DOM collection iteration is unnecessary with `Array.from()` + // see https://github.com/zloirock/core-js/issues/1003 + 'web.dom-collections.iterator', + // WHATWG URL constructor `undefined` base fix is unnecessary // https://bugs.webkit.org/show_bug.cgi?id=216841 // https://github.com/zloirock/core-js/commit/0ef4be7352e900dfa6f1eda27de22f7974576531