Add CoreJS polyfills to modern build (#20676)
parent
039e9b40bd
commit
686424fc70
|
@ -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,
|
||||
},
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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<any>, 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;
|
||||
},
|
||||
});
|
||||
}
|
|
@ -1,4 +1,3 @@
|
|||
import "core-js/modules/web.url.can-parse";
|
||||
import { fromError } from "stacktrace-js";
|
||||
import { UAParser } from "ua-parser-js";
|
||||
|
||||
|
|
Loading…
Reference in New Issue