mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-23 09:16:38 +00:00
Use ES5 build for Safari 12 and below (#9482)
This commit is contained in:
parent
be244b3d00
commit
8141f78a92
@ -86,10 +86,11 @@ const prodBuild = (conf) =>
|
|||||||
|
|
||||||
gulp.task("webpack-watch-app", () => {
|
gulp.task("webpack-watch-app", () => {
|
||||||
// This command will run forever because we don't close compiler
|
// This command will run forever because we don't close compiler
|
||||||
webpack(createAppConfig({ isProdBuild: false, latestBuild: true })).watch(
|
webpack(
|
||||||
{ ignored: /build-translations/, poll: isWsl },
|
process.env.ES5
|
||||||
doneHandler()
|
? bothBuilds(createAppConfig, { isProdBuild: false })
|
||||||
);
|
: createAppConfig({ isProdBuild: false, latestBuild: true })
|
||||||
|
).watch({ ignored: /build-translations/, poll: isWsl }, doneHandler());
|
||||||
gulp.watch(
|
gulp.watch(
|
||||||
path.join(paths.translations_src, "en.json"),
|
path.join(paths.translations_src, "en.json"),
|
||||||
gulp.series("build-translations", "copy-translations-app")
|
gulp.series("build-translations", "copy-translations-app")
|
||||||
|
@ -20,4 +20,5 @@
|
|||||||
"content" in document.createElement("template"))) {
|
"content" in document.createElement("template"))) {
|
||||||
document.write("<script src='/static/polyfills/webcomponents-bundle.js'><"+"/script>");
|
document.write("<script src='/static/polyfills/webcomponents-bundle.js'><"+"/script>");
|
||||||
}
|
}
|
||||||
|
var isS11_12 = /.*Version\/(?:11|12)(?:\.\d+)*.*Safari\//.test(navigator.userAgent);
|
||||||
</script>
|
</script>
|
||||||
|
@ -43,13 +43,16 @@
|
|||||||
<%= renderTemplate('_preload_roboto') %>
|
<%= renderTemplate('_preload_roboto') %>
|
||||||
|
|
||||||
<script crossorigin="use-credentials">
|
<script crossorigin="use-credentials">
|
||||||
import("<%= latestPageJS %>");
|
// Safari 12 and below does not have a compliant ES2015 implementation of template literals, so we ship ES5
|
||||||
window.latestJS = true;
|
if (!isS11_12) {
|
||||||
window.providersPromise = fetch("/auth/providers", {
|
import("<%= latestPageJS %>");
|
||||||
credentials: "same-origin",
|
window.latestJS = true;
|
||||||
});
|
window.providersPromise = fetch("/auth/providers", {
|
||||||
if (!window.globalThis) {
|
credentials: "same-origin",
|
||||||
window.globalThis = window;
|
});
|
||||||
|
if (!window.globalThis) {
|
||||||
|
window.globalThis = window;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -67,12 +67,15 @@
|
|||||||
<%= renderTemplate('_preload_roboto') %>
|
<%= renderTemplate('_preload_roboto') %>
|
||||||
|
|
||||||
<script <% if (!useWDS) { %>crossorigin="use-credentials"<% } %>>
|
<script <% if (!useWDS) { %>crossorigin="use-credentials"<% } %>>
|
||||||
import("<%= latestCoreJS %>");
|
// Safari 12 and below does not have a compliant ES2015 implementation of template literals, so we ship ES5
|
||||||
import("<%= latestAppJS %>");
|
if (!isS11_12) {
|
||||||
window.customPanelJS = "<%= latestCustomPanelJS %>";
|
import("<%= latestCoreJS %>");
|
||||||
window.latestJS = true;
|
import("<%= latestAppJS %>");
|
||||||
if (!window.globalThis) {
|
window.customPanelJS = "<%= latestCustomPanelJS %>";
|
||||||
window.globalThis = window;
|
window.latestJS = true;
|
||||||
|
if (!window.globalThis) {
|
||||||
|
window.globalThis = window;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
|
@ -75,13 +75,16 @@
|
|||||||
<%= renderTemplate('_preload_roboto') %>
|
<%= renderTemplate('_preload_roboto') %>
|
||||||
|
|
||||||
<script crossorigin="use-credentials">
|
<script crossorigin="use-credentials">
|
||||||
import("<%= latestPageJS %>");
|
// Safari 12 and below does not have a compliant ES2015 implementation of template literals, so we ship ES5
|
||||||
window.latestJS = true;
|
if (!isS11_12) {
|
||||||
window.stepsPromise = fetch("/api/onboarding", {
|
import("<%= latestPageJS %>");
|
||||||
credentials: "same-origin",
|
window.latestJS = true;
|
||||||
});
|
window.stepsPromise = fetch("/api/onboarding", {
|
||||||
if (!window.globalThis) {
|
credentials: "same-origin",
|
||||||
window.globalThis = window;
|
});
|
||||||
|
if (!window.globalThis) {
|
||||||
|
window.globalThis = window;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user