Uncaught TypeError: Cannot redefine property: asmLibraryArg

I just updated Unity to 2019.1.5f1 from 2018.2.5f1 and built the project for WebGL.
In 2018 it builds and runs on webGL fine with no errors, however, after this build I'm getting this error when I run it (90% loaded):
Uncaught TypeError: Cannot redefine property: asmLibraryArg

I looked everywhere and can't find the cause for this. Any ideas? It's never had this error before, and I didn't make any changes other than updating Unity.

(Not sure if related)
I'm using a few some javascript files such as this one that need to be in the program.

mergeInto(LibraryManager.library, {
OpenWindow: function(link)
var url = Pointer_stringify(link);
document.onmouseup = function()
document.onmouseup = null;

and calling it in C# like so:
private static extern void OpenWindow(string url);

I am having this error too, do you found how to solve it?

[quote=“Ironjuan”, post:2, topic: 746531]
I am having this error too, do you found how to solve it?
Nope. I had to revert back to my older Unity version. :frowning:
I tried all sorts of things to no avail. No idea what’s causing it or how to fix it. I wish someone could help still. I would really love to upgrade to 2019.

I'm having this issue too. I was wondering if maybe it is something to do with the differences between asmJS and WebAssembly that you could switch between in 2018.2? but I can't find the option to modify this in the player settings any more..

Anyone had any luck on this yet?

So I've located where it bugs out:


So it looks like the error is occuring because it tries to "redefine" this. I found that it does indeed define this earlier:

Does this mean anything to anyone?

I found the cause of the problem. It was an external jslib plugin (https://github.com/kongregate/Unity-WebGL-Utilities). It worked after removing it. Looks like it's conflicting with 2019.1.

If you're publishing your game in Kongregate, you might have come across this plugin.


It was this, thanks very much :) :)

Any fix/workaround for this problem?

I don't use Kongregate's plugin but I have a jslib to talk to my external web application. I'm running into the same error.

I updated to 2019.2 and removed the Unity-WebGL-Utilities and it's working now.

I found a solution to this issue where you can still use unity 2019 and Unity-WebGL-Utilities plugin

if you just comment out the problematic if statement :

Object.defineProperty(Module, "asmLibraryArg", {
    get: function () { return Module.realAsmLibraryArg; },
    set: function (value) {
      if (typeof value == "object" && typeof value._JS_WebRequest_Create == "function")
        value._JS_WebRequest_Create = CachedXMLHttpRequest.wrap(value._JS_WebRequest_Create);
      Module.realAsmLibraryArg = value;

the plugin will still work and the build will run as usual.
not sure whats going on there but it is possible that in 2019 Unity take care of this on their side so the plugin still works even tho the property is no longer available

This discussion talks about needing to remove the Unity-WebGL-Utilities plugin. But I just wanted to add an important addition to this solution that I read from mhama over on GitHub: You also need to remove WebGLCachedXMLHttpRequest if you have it, because apparently Unity started including this plugin directly starting with 2019.