Adding a local JavaScript libraries to JavaScript node

#1

Hi,

i want to add a local JavaScript library to the Generic JavaScript node.
I can load it with require.config from the web.

require.config({
paths: {
“lib1”: “http://sample.com/lib1”,
“lib2”: “http://foo.org/lib2
}
});
require([“lib1”, “lib2”,], function(lib1, lib2) {
lib1.callSomething();
});

How to load it from a local path?

BR,
ptrwlr

0 Likes

#2

Hi,

I think there is two things you can try. You can either read in the library and convert it to a string flow variable which you then can feed into the node, or you can use the file:// protocol to load it from disk directly. If you want to package the library with the workflow or your local repository you can put it inside the directory of the workflow (or repository) and then append the path to the knime.workspace flow variable to get the correct file url at runtime.

1 Like