Does anyone else have an issue when trying to load...
# suitescript
e
Does anyone else have an issue when trying to load moment.js in suitescript2.0? The error I get is " uncaught SuiteScriptModuleLoaderError ". This is only in client scripts. In userevent scripts it works fine.
e
I've had no problems in either script type with moment. Any difference in how you're loading it in the scripts? Can you share the
define
statements for each?
e
define(['N/record', 'N/search', '/SuiteScripts - Globals/moment', 'N/format'], /** * @param {record} record * @param {runtime} runtime * @param {search} search */ function(record, search, moment, format) {
/////////////////// above is client ///////////////below is UE
define(['N/record','N/search','/SuiteScripts - Globals/moment','N/format'], /** * @param {record} record */ function(record, search, moment, format) {
thanks Eric.
e
Interesting; not sure I see any issue with that. Is there any more to the error message on the client side?
e
no, I think it might be a NS defect since the error comes from thier code. I will submit a defect case with them, thanks, again.
e
sure; I've not had a problem using
moment
client-side, but I'm not sure I've done it for some time
e
Eric, one more quick question. Do you do the same define statment as I have? Are you doing anything different.
e
I most commonly use
@NAmdConfig
to specify my module paths
so my
define
statements typically look something like:
Copy code
define(["moment", "N/search"], function (moment, s) ...
with
@NAmdConfig /SuiteScripts/path/to/amdconfig.json
in my module JSDoc
and
amdconfig.json
looks something like:
Copy code
{
  "baseUrl": "/SuiteScripts/path/to/libs",
  "paths": {
    "lodash": "lib/Third Party/lodash/lodash.min.js",
    "moment": "lib/Third Party/moment/moment.min.js",
  }
}