I fixed this by comparing my old index.html to a newly created empty Flutter 3.22 project.
In my case the old index.html body contained something like the following:
<body>
<!-- This script installs service_worker.js to provide PWA
functionality to application. For more information, see:
https://developers.google.com/web/fundamentals/primers/service-workers -->
<script>
var serviceWorkerVersion = null;
var scriptLoaded = false;
function loadMainDartJs() {...}
if ('serviceWorker' in navigator) {..}
else {...}
</script>
</body>
The empty Flutter 3.22 project only contained a single line.
<body>
<script src="flutter_bootstrap.js" async></script>
</body>
I just replaced the long script with the short one from the latest Flutter version (as outlined by the Flutter team here) and things seem to be working now.
Flutter 3.24.1
. – Ineducable