Search Unity

Resolved Unity WebGL build produces invalid code

Discussion in 'Formats & External Tools' started by dangerPanda, Jul 7, 2020.

  1. dangerPanda

    dangerPanda

    Joined:
    Oct 9, 2019
    Posts:
    6
    Using Unity's WebGL build creates a blob file with invalid code in the very first line of code, here is the snippet.

    Code (CSharp):
    1. UnityLoader["7f320e7ff979e7e6fa1625bbb85f32db"]=
    2. var UnityModule = (function() {
    3.   var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
    4.   return (
    5. function(UnityModule) {
    6.   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 if that matters. 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.