RequireJS relative paths breaks some libraries submodules

Hi Christian,

Lots of thanks. I am a bit busy and could not get to it until yesterday. I have not managed yet to load the library but with your help I made some advances.

First, like you said, I am not including the library as a dependency in the plugin configuration. Just the directory:

<webResource relativePathSource="js-lib/codemirror-5.49.2" relativePathTarget="codemirror-5.49.2"></webResource>

I followed the project org.knime.js.testing where loadConditionally is used in https://github.com/knime/knime-js-base/blob/c0a1de78a19a6eaff86405c000f784669666b5e2/org.knime.js.testing/js-src/org/knime/js/node/minimalRequestHandler/requestHandler.js.

In the view the library is loaded with:

// Load CodeMirror
let codemirror_config = {
    packages: [{
        name: "codemirror",
        location: "codemirror-5.49.2",
        main: "lib/codemirror"
    }
    // ,{
    //   name: "codemirror_R",
    //   location: "codemirror-5.49.2",
    //   main: "mode/r/r"
    // }
]};
knimeService.loadConditionally(["codemirror"],
    (arg) => console.log("knimeService installed " + arg),
    (err) => console.log("knimeService failed to install " + err),
    codemirror_config);
window.CodeMirror = codemirror;

This is just loading the base library. I am trying to avoid the errors related to the R mode for now. The library cannot be used in the view yet the success callback is called and the library appears in the Chrome debugger.

image

I have very little time left for this task and will try with RequireJS. By the way, I did not find any use of loadConditionally with the four arguments passed. I only found it used with a single path.

Best,
Miguel