I’m trying to load sprintf library into my scripts. https://github.com/alexei/sprintf.js/blob/master/src/sprintf.js
I uploaded the library into my file cabinet to SuiteScripts/Modules/sprintf.js
If I load the library in client script, it works fine and as expected as following:
/**
* @NApiVersion 2.x
* @NScriptType ClientScript
* @NModuleScope SameAccount
*/
define([
'SuiteScripts/Modules/sprintf.js'],
function (spf){}
]);
However, if I do the same steps in any kind of Server scripts such as user event script or suitelet. It doesn’t load at all. and it throws this error: org.mozilla.javascript.EcmaError: TypeError: Cannot call method “sprintf” of undefined
Note: if you use require function in the chrome debugger, it loads and works fine.
Any Suggestion or help would be much appreciated.