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.
Solved! Go to Solution.
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:
<Javascript continueOnError="false" enabled="true" timeLimit="200" name="JS-hello-user">
<DisplayName>JS-hello-user</DisplayName>
<Properties/>
<ResourceURL>jsc://hello-user.js</ResourceURL>
<IncludeURL>jsc://include.js</IncludeURL>
</Javascript>
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
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:
<Javascript continueOnError="false" enabled="true" timeLimit="200" name="JS-hello-user">
<DisplayName>JS-hello-user</DisplayName>
<Properties/>
<ResourceURL>jsc://hello-user.js</ResourceURL>
<IncludeURL>jsc://include.js</IncludeURL>
</Javascript>
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