ReferenceError: IN_PROCESSING_REQUESTS is not defined
milan-ciganovic opened this issue ยท 7 comments
Hi,
I've followed the guide per Speeding Up Flutter Web Load Time ๐๏ธ
Everything works fine locally, but when deployed I get this error and fails to load main.dart.js:
I've copied all the files from build_tools
folder, added also.
RUN chmod +x ./build_tools/patch_web.sh
RUN ./build_tools/patch_web.sh --ignore-whitespace
And added to index.html:
<picture id="splash">
<source srcset="splash/img/light-1x.png 1x, splash/img/light-2x.png 2x, splash/img/light-3x.png 3x, splash/img/light-4x.png 4x"
media="(prefers-color-scheme: light)">
<source srcset="splash/img/dark-1x.png 1x, splash/img/dark-2x.png 2x, splash/img/dark-3x.png 3x, splash/img/dark-4x.png 4x"
media="(prefers-color-scheme: dark)">
<img class="center" aria-hidden="true" src="splash/img/light-1x.png" alt="">
</picture>
<script>
window.addEventListener('load', function(ev) {
// Download main.dart.js
loadScript('flutter.js').then(() => {
// Download main.dart.js
_flutter.loader.loadEntrypoint({
serviceWorker: {
serviceWorkerVersion: serviceWorkerVersion,
},
onEntrypointLoaded: async function(app) {
let appRunner = await app.initializeEngine();
await appRunner.runApp();
// Remove loading screen when App available:
document.querySelector('#splash').remove();
}
});
})
});
function loadScript(src) {
return new Promise(function (resolve, reject) {
var script = document.createElement('script');
script.src = src;
script.onload = function () { resolve(); };
script.onerror = function () { reject(); };
document.body.appendChild(script);
// console.log('loaded ', src)
});
}
</script>
I've removed from the Dockerfile build:
RUN chmod +x ./build_tools/patch_web.sh
RUN ./build_tools/patch_web.sh --ignore-whitespace
And after the build it works, and it's also way faster... But I'm not sure what is the difference?
@milan-ciganovic is what you're building Open Source so we can read the code to help understand the issue? ๐ญ
@nelsonic It's not open source, unfortunately, I didn't do this part diff -u old.js new.js > file.js.patch
Do I need to do it in the build process as well? I'm using all the files as mentioned in the build_tools example project.
Ok. without a bit more insightful view of the project it's like trying to diagnose in the dark.
Yes, please follow the instructions that @LuchoTurtle put together step-by-step.
If you are still stuck we definitely want to know so that we can improve/update the instructions.
Thanks.
@milan-ciganovic please check #335
I believe there was a line missing from the .patch
file which would initialize the variable that you're having trouble with IN_PROCESSING_REQUESTS
.
If it works, give us a heads up :)
Works great :)
Got 76 performance from Lighthouse. Thanks guys!
Awesome!
Closing :)