Can I add a js library to a customer widget?

Is it possible to include a library (e.g. charts.js) into a customer widget, that it is installed automatically with the customer widget?

The ChartJS Demo Widget 1.3.6 only a reference to the js library is used, which means that you have to install the js library in an extra step.

Best reply by webiq-sk

You can do that - WebIQ doesn't know if it's a library in any way - just add it like your custom widget, BUT you should not do that!

Because that way these problems might occur:

  1. You might want to use another custom widget that also uses that library
  2. This might lead to conflicts if both use the same library and/or different version of it - most libraries do not work anymore if they are loaded twice

Instead, you should create a library package that can be updated independently of your widget (loose coupling) just as we did intentionally with the ChartJS widget.

View original
2 replies