how to fix WEBPACK error with Angular 9 using ngx-vis
What did you do?
Migrated my application to Angular 9.
Running either ng test or ng serve leads to an error when creating DataSet:
For example when executing the following code the error occurs:
import { DataSet, Edge, Node } from 'ngx-vis';
export class GraphData {
constructor(nodes?, edges?) {
this.nodes = new DataSet(nodes);
this.edges = new DataSet(edges);
}
nodes: DataSet;
edges: DataSet;
}
What did you expect to happen?
DataSet Structure to be created, finally the Network to be displayed
What happened instead?
TypeError: ngx_vis__WEBPACK_IMPORTED_MODULE_0__.DataSet is not a constructor at <Jasmine> at new GraphData (http://localhost:9876/_karma_webpack_/src/app/component-utils/graph-vis/graph-model.ts:6:10) at UserContext.<anonymous> (http://localhost:9876/_karma_webpack_/src/app/component-utils/graph-vis/graph-vis.component.spec.ts:23:27) at ZoneDelegate../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (http://localhost:9876/_karma_webpack_/node_modules/zone.js/dist/zone.js:386:1) at ProxyZoneSpec.push../node_modules/zone.js/dist/zone-testing.js.ProxyZoneSpec.onInvoke (http://localhost:9876/_karma_webpack_/node_modules/zone.js/dist/zone-testing.js:292:1) at ZoneDelegate../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (http://localhost:9876/_karma_webpack_/node_modules/zone.js/dist/zone.js:385:1) at Zone../node_modules/zone.js/dist/zone.js.Zone.run (http://localhost:9876/_karma_webpack_/node_modules/zone.js/dist/zone.js:143:1) at runInTestZone (http://localhost:9876/_karma_webpack_/node_modules/zone.js/dist/zone-testing.js:545:1) at UserContext.<anonymous> (http://localhost:9876/_karma_webpack_/node_modules/zone.js/dist/zone-testing.js:560:1) at <Jasmine>
Your Environment
Angular version: 9.1.11
NodeJS and NPM version: v12.16.1 and 6.14.4
https://github.com/visjs/ngx-vis/issues/406
Source: New feed
Source Url how to fix WEBPACK error with Angular 9 using ngx-vis
please provide detail example of ngx-vis network topology set in angular project