Hi all, I created a new aurelia project and installed gojs via npm. I added gojs to the aurelia.json dependencies and, without adding any gojs code, just tried to build. The build worked fine and gojs went to the vendor-bundle.js The issue is, when I run the project, I get errors from gojs. When I remove the gojs dependency in aurelia.json, the project runs just fine but adding it back always throws the same error located below. Please help.
I noticed it was done in a forum post by another user before. Basically, if I want to make use of 3rd party items like d3, gojs, or even kendo. I just need to add them to the vendor-bundle dependency for the project. It’s just a pointer to their location in the node-modules folder.
I found the issue, seems gojs and requirejs want to load two empty definitions of define. Because Aurelia loads the vendor bundle after prepending requirejs, requirejs cannot resolve the duplicate load so it throws the error. To solve the problem I just had to prepend gojs before requirejs and it recognized that the define was already there and resolved accordingly. It was just placing gojs in a different location. This is not something new users to Aurelia will face as Aurelia has defaulted webpack on a new project create. Webpack resolves most duplicates issues, this being one of them. Anyone using straight requirejs will have this issue but they can resolve it as stated above. I posted my issue on Stackoverflow. Here is the link where the solution resides. gojs and Aurelia mismatch error - Stack Overflow
The problem now is to find out why it is that way with gojs only, so far, but this is a resolution to the issue.
I see. I think it may be because our library uses an anonymous define:
We’ll consider switching to a named define statement, which will probably fix this
But we need to make sure this won’t affect current users adversely.
If you wanted to try this in your own project, you could edit the go.js file by searching for define and replacing whatever it is, say window.define(ca) to window.define('go', ca). (that’s what it’s minified as in the latest go.js release)
That would at least confirm that the anonymous define is the issue.