Hi,
I agree that it can be cumbersome to get this to work. Most of the time, the problem is that the Asynchronous Module Definition hijacks the module. I circumvent this by manually defining module and exports objects, then create a require function that returns exactly what the imported module needs and reset everything again after the module has loaded. Also, I usually load external dependencies via GET Request node and then insert them via flow variable. The code in the Generic JS View looks like this:
var module = {};
var exports = {};
module.exports = exports;
// Mock the require call to return jquery
var def = define;
var req = require;
define = null;
require = function() {
return $;
}
$${Sbody}$$
// Reset
define = def;
require = req;
I attached a workflow where the library (the version with all dependencies) is used in the Generic JS View.
Kind regards,
Alexander