These examples show two techniques to call a module cross-scope.
Sample Class demonstrates creating a server side script to expose and wrap a module in a class so that it can be used similarly to traditional script includes.
var sample = new SampleClass();
sample.getTestOne();
Create a script include to expose "require" so that modules can be referenced cross-scope. You will need to modify the api_name
property to use your application's scope.
Once installed use the script by calling {scope_name}.x_require with the path that you copied from the module in the sys_module table.
// ES6+:
const { methodA, propertyB } = x_snc_scope_name.x_require("full/path/of/es_module/in/sys_module/table");
// ES5:
var myModule = x_snc_scope_name.x_require("full/path/of/es_module/in/sys_module/table");
myModule.methodA();
myModule.propertyB;