Use ES5 build for Safari 12 and below (#9482)

This commit is contained in:
Bram Kragten 2021-06-30 12:02:01 +02:00 committed by GitHub
parent be244b3d00
commit 8141f78a92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 35 additions and 24 deletions

View File

@ -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")

View File

@ -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>

View File

@ -43,6 +43,8 @@
<%= renderTemplate('_preload_roboto') %> <%= renderTemplate('_preload_roboto') %>
<script crossorigin="use-credentials"> <script crossorigin="use-credentials">
// Safari 12 and below does not have a compliant ES2015 implementation of template literals, so we ship ES5
if (!isS11_12) {
import("<%= latestPageJS %>"); import("<%= latestPageJS %>");
window.latestJS = true; window.latestJS = true;
window.providersPromise = fetch("/auth/providers", { window.providersPromise = fetch("/auth/providers", {
@ -51,6 +53,7 @@
if (!window.globalThis) { if (!window.globalThis) {
window.globalThis = window; window.globalThis = window;
} }
}
</script> </script>
<script> <script>

View File

@ -67,6 +67,8 @@
<%= renderTemplate('_preload_roboto') %> <%= renderTemplate('_preload_roboto') %>
<script <% if (!useWDS) { %>crossorigin="use-credentials"<% } %>> <script <% if (!useWDS) { %>crossorigin="use-credentials"<% } %>>
// Safari 12 and below does not have a compliant ES2015 implementation of template literals, so we ship ES5
if (!isS11_12) {
import("<%= latestCoreJS %>"); import("<%= latestCoreJS %>");
import("<%= latestAppJS %>"); import("<%= latestAppJS %>");
window.customPanelJS = "<%= latestCustomPanelJS %>"; window.customPanelJS = "<%= latestCustomPanelJS %>";
@ -74,6 +76,7 @@
if (!window.globalThis) { if (!window.globalThis) {
window.globalThis = window; window.globalThis = window;
} }
}
</script> </script>
<script> <script>
{% for extra_module in extra_modules -%} {% for extra_module in extra_modules -%}

View File

@ -75,6 +75,8 @@
<%= renderTemplate('_preload_roboto') %> <%= renderTemplate('_preload_roboto') %>
<script crossorigin="use-credentials"> <script crossorigin="use-credentials">
// Safari 12 and below does not have a compliant ES2015 implementation of template literals, so we ship ES5
if (!isS11_12) {
import("<%= latestPageJS %>"); import("<%= latestPageJS %>");
window.latestJS = true; window.latestJS = true;
window.stepsPromise = fetch("/api/onboarding", { window.stepsPromise = fetch("/api/onboarding", {
@ -83,6 +85,7 @@
if (!window.globalThis) { if (!window.globalThis) {
window.globalThis = window; window.globalThis = window;
} }
}
</script> </script>
<script> <script>