I installed vis.js through npm npm install vis-network
and already require it in my app.js
try {
require('vis-network');
} catch (e) { }
and recompiled it in laravel mix
npm run dev
but whenever I instantiate a vis instance I always get vis is not define error on console..
<script>
let nodes = new vis.DataSet(_nodes),
edges = new vis.DataSet(_connections);
...
let network = new vis.Network(container, { nodes: nodes, edges: edges }, _options);
</script>
What am I missing?
Try adding it to the window object, to escape the node encapsulating context.
try {
window.vis = require('vis-network/standalone');
} catch (e) {
console.error(e);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With