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

View File

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

View File

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