cytoscape-angular icon indicating copy to clipboard operation
cytoscape-angular copied to clipboard

dependencies not referenced correctly

Open mmestas opened this issue 4 years ago • 3 comments

I'm using this in an angular 12 application and got several reference errors from this library. Eventually, I got it to work by changing the node-module directly by adding/changing the references in cytoscope-angular.js :

import { ButtonModule } from 'primeng/button'; import { DropdownModule } from 'primeng/dropdown'; import { FieldsetModule } from 'primeng/fieldset'; import { InputSwitchModule } from 'primeng/inputswitch'; import { InputTextModule } from 'primeng/inputtext'; import { OverlayPanelModule } from 'primeng/overlaypanel'; import { ProgressBarModule } from 'primeng/progressbar'; import { ProgressSpinnerModule } from 'primeng/progressspinner'; import { TooltipModule } from 'primeng/tooltip'; import { SpinnerModule } from 'primeng/spinner'; import { AutoCompleteModule } from 'primeng/autocomplete';

and

import * as cytoscape from 'cytoscape';

The errors were that cytoscape was not defined and the above primeng references had no exported module xx. It seems that each module has to be referenced individually and that cytoscape cannot be globally referenced without declaring it in an import.

mmestas avatar Jul 15 '21 15:07 mmestas

Yes the latest version should have the new package names to catch up with primeng changes. I’m still having trouble with the CytoscapeAngularModule being recognized, I’ll see if your import helps with that.

michaelbushe avatar Jul 15 '21 16:07 michaelbushe

I'm getting a cityscape is not defined error and it seems to be related to the above. @mmestas would you be able to share what your imports look like in your Angular component?

I followed the example project to a T but still nothing 🤷‍♂️

Edit: specific error message is:

main.js:137353 ERROR ReferenceError: cytoscape is not defined
    at CytoscapeGraphComponent.rerender (main.js:62384)
    at main.js:62333
    at timer (polyfills.js:2933)
    at ZoneDelegate.invokeTask (polyfills.js:553)
    at Object.onInvokeTask (main.js:159381)
    at ZoneDelegate.invokeTask (polyfills.js:553)

RobRoyce avatar Apr 22 '22 05:04 RobRoyce

The odd part is I actually get a canvas with a single node (which is outlined by a "loading" animation, presumably). So cityscape is, in fact, imported into the project.

RobRoyce avatar Apr 22 '22 20:04 RobRoyce