0

I’m developing my datasource plugin based on simple-json. I want to use the library angular-ivh-treeview, but I do not understand how to use it in the plugin. Can someone help me?

1 Answers1

1

To use an external JavaScript lib in a plugin, you have to include it in the plugin code. JavaScript libraries in node_modules are only used at build time and are not included in the output.

To take an example, here is the Plotly panel plugin that includes the Plotly lib in a subdirectory named lib:

https://github.com/NatelEnergy/grafana-plotly-panel/tree/master/src/lib

and then uses it here:

https://github.com/NatelEnergy/grafana-plotly-panel/blob/master/src/module.js#L8

Another example - the GeoLoop plugin that includes the mapboxgl library:

https://github.com/CitiLogics/citilogics-geoloop-panel/blob/master/src/geoloop.js#L3

Daniel Lee
  • 7,709
  • 2
  • 48
  • 57