diff --git a/build-scripts/bundle.cjs b/build-scripts/bundle.cjs index df95d10d22..9c292c7921 100644 --- a/build-scripts/bundle.cjs +++ b/build-scripts/bundle.cjs @@ -92,8 +92,8 @@ module.exports.babelOptions = ({ latestBuild, isProdBuild, isTestBuild }) => ({ [ "@babel/preset-env", { - useBuiltIns: latestBuild ? false : "usage", - corejs: latestBuild ? false : dependencies["core-js"], + useBuiltIns: "usage", + corejs: dependencies["core-js"], bugfixes: true, shippedProposals: true, }, diff --git a/src/entrypoints/authorize.ts b/src/entrypoints/authorize.ts index e26b398e7a..cc3e208d81 100644 --- a/src/entrypoints/authorize.ts +++ b/src/entrypoints/authorize.ts @@ -2,7 +2,6 @@ import "../resources/compatibility"; import "../auth/ha-authorize"; import "../resources/safari-14-attachshadow-patch"; -import "../resources/array.flat.polyfill"; import("../resources/ha-style"); import("@polymer/polymer/lib/utils/settings").then( diff --git a/src/entrypoints/core.ts b/src/entrypoints/core.ts index e9bf6b4c00..bcd6138a0d 100644 --- a/src/entrypoints/core.ts +++ b/src/entrypoints/core.ts @@ -25,7 +25,6 @@ import { subscribePanels } from "../data/ws-panels"; import { subscribeThemes } from "../data/ws-themes"; import { subscribeUser } from "../data/ws-user"; import type { ExternalAuth } from "../external_app/external_auth"; -import "../resources/array.flat.polyfill"; import "../resources/safari-14-attachshadow-patch"; window.name = MAIN_WINDOW_NAME; diff --git a/src/entrypoints/onboarding.ts b/src/entrypoints/onboarding.ts index 3d1ea41547..9deb735927 100644 --- a/src/entrypoints/onboarding.ts +++ b/src/entrypoints/onboarding.ts @@ -2,7 +2,6 @@ import "../resources/compatibility"; import "../onboarding/ha-onboarding"; import "../resources/safari-14-attachshadow-patch"; -import "../resources/array.flat.polyfill"; import("../resources/ha-style"); import("@polymer/polymer/lib/utils/settings").then( diff --git a/src/resources/array.flat.polyfill.ts b/src/resources/array.flat.polyfill.ts deleted file mode 100644 index 61462cfb6d..0000000000 --- a/src/resources/array.flat.polyfill.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* eslint-disable no-extend-native */ - -export {}; // for Babel to treat as a module - -if (!Array.prototype.flat) { - Object.defineProperty(Array.prototype, "flat", { - configurable: true, - writable: true, - value: function (...args) { - const depth = typeof args[0] === "undefined" ? 1 : Number(args[0]) || 0; - const result = []; - const forEach = result.forEach; - - const flatDeep = (arr: Array, dpth: number) => { - forEach.call(arr, (val) => { - if (dpth > 0 && Array.isArray(val)) { - flatDeep(val, dpth - 1); - } else { - result.push(val); - } - }); - }; - - flatDeep(this, depth); - return result; - }, - }); -} diff --git a/src/resources/log-message.ts b/src/resources/log-message.ts index 4372822c1f..28f810b897 100644 --- a/src/resources/log-message.ts +++ b/src/resources/log-message.ts @@ -1,4 +1,3 @@ -import "core-js/modules/web.url.can-parse"; import { fromError } from "stacktrace-js"; import { UAParser } from "ua-parser-js";