WebGL build produces invalid code

Using Unity’s WebGL build creates a blob file with invalid code in the very first line of code, here is the snippet.

UnityLoader["7f320e7ff979e7e6fa1625bbb85f32db"]=
var UnityModule = (function() {
  var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
  return (
function(UnityModule) {
  UnityModule = UnityModule || {};

As you can see UnityLoader["7f320e7ff979e7e6fa1625bbb85f32db"]= has a dangling equals sign and the Javascript compiler throws an error of Uncaught SyntaxError: Unexpected token 'var' as a result.

This is blocking all progress on my game development. Is this something I can fix or is this a problem the Unity team needs to fix?

I am using angular 7 and Unity 2019.4.2f1 if that helps. I would like to exclude this file from the angular compiler but I cannot since, the filename is a random hash at the root directory with no extension.

@dangerPanda did you figure out a workaround for this issue? We are also using the WebGL build artifacts inside an angular project and hitting the same issue.

The generated code does certainly look incorrect.

I have a very vague recollection of a JS syntax error bug like this. Version 2019.4.2f1 is quite old, I wonder if the issue still occurs with 2019.4.13f1?

I have same problem. Unity 2019.4.12f1 (64-bit)

Can you report a bug with a reduced test case? That’ll help our QA verify and we’ll get to the bottom of this.

In version 2019.4.13 the error is repeated, but in version 2020.1.10 - no