diff --git a/build-scripts/gulp/entry-html.js b/build-scripts/gulp/entry-html.js
index eeb1b57ecc..c98b6d6acb 100644
--- a/build-scripts/gulp/entry-html.js
+++ b/build-scripts/gulp/entry-html.js
@@ -302,15 +302,23 @@ gulp.task("gen-index-hassio-prod", async () => {
function writeHassioEntrypoint(latestEntrypoint, es5Entrypoint) {
fs.mkdirSync(paths.hassio_output_root, { recursive: true });
+ // Safari 12 and below does not have a compliant ES2015 implementation of template literals, so we ship ES5
fs.writeFileSync(
path.resolve(paths.hassio_output_root, "entrypoint.js"),
`
-try {
- new Function("import('${latestEntrypoint}')")();
-} catch (err) {
+function loadES5() {
var el = document.createElement('script');
el.src = '${es5Entrypoint}';
document.body.appendChild(el);
+}
+if (/.*Version\/(?:11|12)(?:\.\d+)*.*Safari\//.test(navigator.userAgent)) {
+ loadES5();
+} else {
+ try {
+ new Function("import('${latestEntrypoint}')")();
+ } catch (err) {
+ loadES5();
+ }
}
`,
{ encoding: "utf-8" }