Unity 2020.1 - Invalid or unexpected token error from compressed framework.js file

Hello,

Do exports using compressions (gzip / brotli) work after upload on a server for anyone?

I have just tested it on 3 various servers (using nginx / apache, with cloudfale, without it, with various compression configuration) and received the same error - “Uncaught SyntaxError: Invalid or unexpected token” going from framework.js.br / framework.js.gz file in all attempts (there were downloaded new files on every attempt - I was aware to avoid loading from the cache).

When it worked for me:
Launch on localhost (Build and run option) and launch of unity build with disabled compression on the same servers was ok - the build loaded as expected.

I am sure that the issue is related to the compression. However, I have had no problem with builds made in previous Unity versions which were also using compression and even similar structure of files. Detecting certain issue is quite complicated when I have not found no place when it would work for me, thus I am interested whether it is some problem on my side or a general problem in alpha version of the unity.

Please, share your experience with me - whether builds work for you or you face the same problem…

NOTE: I tested a build with 1 empty scene

I am encountering the same issue with Unity3d 2020.1 beta Webgl builds with compression turned on (gz).

Using Build & Run from Unity3D, it works with both compression turned on/off.

I run my own iis server and can verify that:

  • Build with compression turned off run with no problem in the browsers.
  • Build with compression turned on will encounter the issue described above.

1 Like

I guess this is due to the needed change to support the brotli / gz files with their new naming conventions, maybe that thread will help you: Changes to the WebGL loader and templates introduced in Unity 2020.1

1 Like

Thank you!!!

This solves my issue as well: https://discussions.unity.com/t/786688