Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GoJS with Angular 14.x works locally but not on Stackblitz #44

Closed
SigmaOutdoors opened this issue Jul 27, 2022 · 8 comments
Closed

GoJS with Angular 14.x works locally but not on Stackblitz #44

SigmaOutdoors opened this issue Jul 27, 2022 · 8 comments

Comments

@SigmaOutdoors
Copy link

SigmaOutdoors commented Jul 27, 2022

I am trying to have a discussion with support and it would be very easy to share code on Stackblitz, but once I upgrade after Angular 12.5 things stop working. Here is an example I got up to Angular 12.5 then past that it won't work, just to be clear the only thing I did between 12.5 working example is upgrade dependencies:

Works (v12.5)

https://stackblitz.com/edit/angular-gojs-xa4mc1?file=README.md

Does NOT work (v14+)

https://stackblitz.com/edit/angular-gojs-48pipq?file=README.md

Error in src/app/library/library.component.ts (1:29)
Cannot find module '@angular/compiler/src/render3/r3_ast' or its corresponding type declarations.

Here is another example that works LOCALLY on my machine but doesn't work in Stackblitz:

https://stackblitz.com/edit/github-xjnzp2?file=src/app/_components/drag-drop/drag-drop.component.ts

Error in src/app/app.module.ts (19:5)
'GojsAngularModule' does not appear to be an NgModule class.

@WalterNorthwoods
Copy link
Contributor

In looking at the v14 "Does NOT work" sample in Stackblitz, I notice that the package.json file has this:

    "gojs": "^2.2.12",
    "gojs-angular": "^2.0.4",

but the package-lock.json file has this:

    "gojs": {
      "version": "2.1.42",
      "resolved": "https://registry.npmjs.org/gojs/-/gojs-2.1.42.tgz",
      "integrity": "sha512-PurmYw8Uefl9UbqjLl2MwwYRRwq4RsgcfGQWawgPfngQU5IFSopJNNsNZ9V/B+DlTUa6b21f3NFpslp19moOjQ=="
    },
    "gojs-angular": {
      "version": "2.0.0",
      "resolved": "https://registry.npmjs.org/gojs-angular/-/gojs-angular-2.0.0.tgz",
      "integrity": "sha512-PG2CzOr3a5ax77NoOaK/z4rES1SLriH5h9TwL1p6hrem7O/5BKju6JzOQyaC1twJRSOOwLyvabOp4IuiWBayRA==",
      "requires": {
        "immer": "^9.0.1",
        "tslib": "^2.0.0"
      }
    },

Could you please explain how this is possible? If you fix the dependencies, do things work better?

@SigmaOutdoors
Copy link
Author

SigmaOutdoors commented Jul 27, 2022 via email

@SigmaOutdoors
Copy link
Author

SigmaOutdoors commented Jul 27, 2022

In order to make things better organized, I have renamed the projects and and they are available here:

https://stackblitz.com/@SigmaOutdoors


Angular GoJs Example 12.2.5 - Works                       // Working example, upgraded and working as far as Angular 12.2.5

Angular GoJs Example Upgrade to 14.x - Compile Error      // 12.2.5 Example upgraded to 14+ : Error in src/app/app.module.ts (18:5)  'GojsAngularModule' does not appear to be an NgModule class.

Sigma GoJs Angular v14+ - Compile Error                   // 14+ A different example that works locally but not on StackBlitz  : Error in src/app/app.module.ts (18:5)  'GojsAngularModule' does not appear to be an NgModule class.

@WalterNorthwoods
Copy link
Contributor

Hmmm. I'm sorry, but I have been unable to figure out exactly which files are being loaded in Stackblitz. I noticed that an incompatibility of Angular 14 compared with Angular 12 is that ES modules are now the default, not UMD modules. But I couldn't find the actual file that it loaded for GoJS to see whether it loaded "go.js" or "go-module.js". If it's actually using ES modules, you'll need to use "go-module.js".

Note that the package.json for GoJS includes this setting:

  "module": "release/go-module.js",

But maybe that's not enough for the Angular environment?

@SigmaOutdoors
Copy link
Author

SigmaOutdoors commented Jul 27, 2022

It sounds like you're on to something, I tried going back a bit in my tsconfig but get the same error. I have provided the valid values in comments below I didn't really see anything about UDM...


"moduleResolution": "Classic",
    "importHelpers": true,
    "target": "es2015",
    "module": "es2015",
    "lib": [
      "es2015",
      "dom"
    ]
  }
}

/*  target & module : 
 Valid values: "ES5", "ES6", "ES2015", "ES2015.Collection", "ES2015.Core", "ES2015.Generator", "ES2015.Iterable", "ES2015.Promise", "ES2015.Proxy", "ES2015.Reflect", "ES2015.Symbol.WellKnown", "ES2015.Symbol", "ES2016", "ES2016.Array.Include", "ES2017", "ES2017.Intl", "ES2017.Object", "ES2017.SharedMemory", "ES2017.String", "ES2017.TypedArrays", "ES2018", "ES2018.AsyncGenerator", "ES2018.AsyncIterable", "ES2018.Intl", "ES2018.Promise", "ES2018.Regexp", "ES2019", "ES2019.Array", "ES2019.Object", "ES2019.String", "ES2019.Symbol", "ES2020", "ES2020.BigInt", "ES2020.Promise", "ES2020.String", "ES2020.Symbol.WellKnown", "ESNext", "ESNext.Array", "ESNext.AsyncIterable", "ESNext.BigInt", "ESNext.Intl", "ESNext.Promise", "ESNext.String", "ESNext.Symbol", "DOM", "DOM.Iterable", "ScriptHost", "WebWorker", "WebWorker.ImportScripts", "Webworker.Iterable", "ES7", "ES2021", "ES2020.SharedMemory", "ES2020.Intl", "ES2021.Promise", "ES2021.String", "ES2021.WeakRef", "ESNext.WeakRef", "es2021.intl", "ES2022", "ES2022.Array", "ES2022.Error", "ES2022.Intl", "ES2022.Object", "ES2022.String".(1)

 #
moduleResolution : "Classic", "Node", "Node16", "NodeNext".

*/

@SigmaOutdoors
Copy link
Author

SigmaOutdoors commented Jul 28, 2022 via email

@WalterNorthwoods
Copy link
Contributor

WalterNorthwoods commented Jul 28, 2022

To clarify, the GoJS library has no dependencies on any library or framework, other than the HTML DOM and JavaScript that the browser provides. The gojs-angular components in this repository indeed depend on Angular, currently version 11.

We were able to reproduce your problem with Stackblitz after upgrading this gojs-angular project to Angular 14. Everything is fine when running locally, without Stackblitz.

Always keeping up with the latest version can harm most people who just want to use a stable version.

Good luck with the Stackblitz team.

@SigmaOutdoors
Copy link
Author

SigmaOutdoors commented Jul 28, 2022

We were able to reproduce your problem with Stackblitz after upgrading this gojs-angular project to Angular 14. Everything is fine when running locally, without Stackblitz.

This is good to know, thank you for trying that.

Always keeping up with the latest version can harm most people who just want to use a stable version.

Agreed, sort of. That's why there are versions, if people want to sit on a 2.5 year old version, that is then their choice. Others shouldn't have to be penalized with that choice, as I said Angular moves fast. As we agreed, your package should work for a while, but the rate at which Angular updates, I wouldn't want to be 3 versions behind (as a developer).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants