While integrating GoJS into an internal library as part of its evaluation, we ran into an interesting issue: after deployment we found that the application consuming our library was no longer able to load. After debugging, we discovered that the underlying reason was that, despite our library being built by WebPack as a single self-contained bundle, GoJS’s UMD implementation had found the AMD loader of our parent application globalThis.define.amd
and was attempting to register itself.
The application consuming our library uses Dijit’s require which, according to this forum post (GoJS with Aurelia Mismatch Error - #8 by simon), is known to not work with the UMD implementation used by GoJS. In this case, since GoJS was being bundled by WebPack, the attempt to register globally is not a desired trait. Is there a way to get an ESM-only version of GoJS, or would there be a way to add a flag that could used to avoid registering via AMD (e.g. window.skipGoJSUMD = true;
)
If neither of the above two solutions would work, could the UMD implementation be updated to check globalThis.define.amd
to see if the require implementation is from dijit, so it could use a named export, as dijit expects?