RequireJS jquery shim dependency

When being evaluated by NetSuite module loader I am getting the following error: Fail to evaluate script: {“type”:”error.SuiteScriptModuleLoaderError”,”name”:”MODULE_DOES_NOT_EXIST”,”message”:”Module does not exist: /jquery-ui.js”,”stack”:[]}

This problem arises when having dependencies of jquery in AMDConfig like so:


{

"baseUrl": "SuiteScripts/..../Libraries/",

"paths": {

"jquery": "jquery-3.2.1.min",

"jquery-ui": "jquery-ui.min",

},

"shim": {

"jquery": {

"exports": "$",

},

"jquery-ui": {

"deps": ["jquery"] // removing this dependency prevents error

},

}

}

Then referencing in code as below:

/**

* @NApiVersion 2.x

* @NScriptType ClientScript

* @NModuleScope SameAccount

* @NAmdConfig ../config.json

*/

define(['jquery', 'jquery-ui'], function($) {

...

})


Has anyone encountered this or found a solution? I want to have jquery as the jquery-ui dependency because it truly is dependent, since requirejs loads async sometimes they do not load in the correct order and ui does not attach properly

Thanks

Intermediate Asked on January 28, 2020 in SuiteCloud.
Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Limebox   Become a Sponsor