Does anyone know if you can use absolute paths for...
# suitescript
e
Does anyone know if you can use absolute paths for the
@NAmdConfig
path? Such as
/SuiteScripts/JsLibraryConfig.json
?
Copy code
/**
* @NApiVersion 2.x
* @NScriptType usereventscript
* @NAmdConfig  ./JsLibraryConfig.json
*/
s
just try it? personally I avoid using
@NAmdConfig
due to it's top-level limitation.
e
Yeah I tried it... it does not work
s
add that to the list of limitations 🙂
e
Yeah that's a dagger for me. I can't imagine having to update scripts if I want to move them into a subfolder or something
b
ill give the boring it works for me
e
^An absolute path?
b
Copy code
/**
 * @NApiVersion 2.1
 * @NScriptType Suitelet
 * @NAmdConfig  /SuiteScripts/config.json
 */
define(["lib"], function (lib) {
  return {
    onRequest: function onRequest(context) {
      log.debug("context", context);

      lib.loggingFunction();
    },
  };
});
Copy code
{
  "paths": {
    "lib": "./library.js"
  }
}
Copy code
define([], function () {
  return {
    loggingFunction: function () {
      log.debug("im a log", "from a library");
    },
  };
});
e
libraries.json file in SuiteScripts folder
Copy code
{
  "paths": {
    "css_library": "/SuiteScript/cssLibrarySS2.js"
  }
}
cssLibrarySS2.js file in SuiteScripts folder
Copy code
/**
 *@NApiVersion 2.x
 */
define(['N/ui/dialog'], function (dialog) {

    function popUp(someString) {
        var options = {
            title: 'Notice',
            message: someString
        };

        dialog.create(options);
    }

    return {
        popUp: popUp
    }
});
Try to create this client script...
Copy code
/**
 *@NApiVersion 2.x
 *@NScriptType ClientScript
 *@NAmdConfig /SuiteScripts/libraries.json
 */
define(["css_library"], function (cssLibrary) {

    function pageInit(context) {
        cssLibrary.popUp("cool string");
    }

    return {
        pageInit: pageInit
    }
});
Get Error: Fail to evaluate script: {"type":"error.SuiteScriptModuleLoaderError","name":"MODULE_DOES_NOT_EXIST","message":"Module does not exist: /SuiteScript/cssLibrarySS2.js","stack":[]}
b
make sure your file is available publically
e
the JS or JSON?
b
json loaded fine
do the js
e
Set it to Available without Login (assuming thats what you meant by available publicly) but got the same error
Ugh... I found the issue
Copy code
{
  "paths": {
    "css_library": "/SuiteScript/cssLibrarySS2.js"
  }
}
path should be SuiteScripts not SuiteScript
b
hahaha
e
😅