visjs / vis-network

:dizzy: Display dynamic, automatically organised, customizable network views.
https://visjs.github.io/vis-network/
Apache License 2.0
3.09k stars 374 forks source link

using vis-network with express #1261

Open fdelmotte opened 3 years ago

fdelmotte commented 3 years ago

Hello

In my JS script I have : const vis = require('vis-network'); But when I try to use the script I have the following error : TypeError: vis.DataSet is not a constructor Because of this line: function DrawingDevices(){ var nodes = new vis.DataSet([

Is it a normal behaviour with express ?

Thomaash commented 3 years ago

Hi @fdelmotte,

that's weird, what you have there should work.

Does the following work?

const vis = require("vis-network/standalone");

Or this one, if you don't have ESM?

const vis = require("vis-network/standalone/umd/vis-network");
fdelmotte commented 3 years ago

Hi, Thank you for your help. The following syntax is working "const vis = require("vis-network/standalone/umd/vis-network");". Happy new year :)

docentYT commented 2 months ago

In angular I had to replace

import * as vis from 'vis-network';

with

import * as vis from 'vis-network/standalone/umd/vis-network';