diff --git a/angular.json b/angular.json
index a032f797530..a7708d10633 100644
--- a/angular.json
+++ b/angular.json
@@ -24,6 +24,7 @@
"loaders": "prepend"
}
},
+ "indexTransform": "webpack/index-html-transform.ts",
"allowedCommonJsDependencies": [
"cerialize",
"core-js",
diff --git a/package.json b/package.json
index b2317522508..10600248b76 100644
--- a/package.json
+++ b/package.json
@@ -198,6 +198,7 @@
"sass": "~1.94.2",
"sass-loader": "^12.6.0",
"sass-resources-loader": "^2.2.5",
+ "terser": "5.29.1",
"ts-node": "^8.10.2",
"typescript": "~5.4.5",
"webpack": "5.101.0",
diff --git a/src/anti-flicker-overlay.js b/src/anti-flicker-overlay.js
new file mode 100644
index 00000000000..769d59e4fda
--- /dev/null
+++ b/src/anti-flicker-overlay.js
@@ -0,0 +1,197 @@
+/* eslint-disable */
+// This file is inlined verbatim into index.html at build time (see webpack/index-html-transform.ts,
+// wired via the build's indexTransform in angular.json). It must stay dependency-free, ES5-safe and
+// self-contained: it runs as a synchronous inline " in the minified output closing the tag early.
+ const safe = result.code.replace(/<\/script>/gi, '<\\/script>');
+ return indexHtml.replace(MARKER, ``);
+}