Hi,
I have a script-1.js file and I have the below line of code.( flow is like, if condition meets, I have to enter into other JS file).
var script2 = require(‘./Script-2.js’);
I am getting reference error like require is not defined.
Appreciate any support on this.
Checkout the docs for Javascript policy for the usage of element “IncludeURL” . The IncludeURL will point to the javascript that \ your main javascript to be dependent on.
Here is an example:
JS-hello-user
jsc://hello-user.js
jsc://include.js
Content for hello-user.js (this will be your main js)
stepMethod();
Content for include.js
function stepMethod() {
print(‘Inside include’);
}
Hope this helps.
Thanks
2 Likes