While deploying a 3d scada WebGL app for my boss, I found the following errors on the browser regarding js file.
“Unable to parse Build/app.framework.js.gz! This can happen if build compression was enabled but web server hosting the content was misconfigured to not serve the file with HTTP Response Header “Content-Encoding: gzip” present. Check browser Console and Devtools Network tab to debug.”
After an extensive research on searching engine, I found out it is related to compression on the exported webgl app from the original Unity project. When in Unity, one can toggle Edit->Project Settings->Player->WebGL->Publishing Settings->Decompression fallback to true, thus a file with extension js.unityweb will replace the the original js.gz file, so that you don’t have to config the server to handle js.gz file manually, Unity will handle it for you.
According to the official webpage on publishing Unity WebGL app, the decompression fallback option enables Unity to automatically embed a JavaScript decompressor into your build. The compression option is pretty nice since it reduces the size on the server and thus site traffic, yet it needs to be carefully configurated. Unity also gives a webpage with sample configs for nginx and Apache.
Leave a Reply