How to use 3rd library js in JavaScript Node source code?

Hi,
I found many third-party libraries in this directory,
image

So I think these JS libraries are all referenceable in the source code.

I tried to modify the code in the JS file in this path,
image
add the reference on plugin.xml ,

and then I call the RequireJS method,
image

, when i run node in knime,the console report an error.(require is not defined…)
image

I noticed that although didn’t directly reference the d3 and jQuery libraries, I can use them directly in the code.

How can I use other 3rd libraries on js code as d3 and jQuery ?
Is there something I have done wrong?

Thanks ,
Will

To add a 3rd javascript library, I use to download its files and include them in my plugin.
The plugin.xml file will have an additional webResourceBundle dedicated to this library (in your case alertify).
Finally the webResourceBundle of the javascript view will include a webDependency tag for the added library webResourceBundle.

1 Like

Hi arofab,
Can you help me check my step and find what I done wrong? Thank you very much !

Step1:
I copy “eCharts” to this folder,
image
image

Step2:
edit this file add webResourceBundle,
image

Step3:
go to this path and edit this xml file:
image

Step4:
add echarts code in js file and reboot knime.

Step5:
run custom JavaScript Node and get this error:

image

At a first sight, the source and relative paths attributes of webResource tag in your echarts’ webResourceBundle seem to be wrong: they should only include the path and not the filename.