Diderik
07/12/2022, 9:44 AMN/cache
(which is not available in Client Scripts). So I have made module C that has the same functionality, but without using N/cache
. In my AMD config I have in path an alias that points directly to module B. Now I want to configure it in such a way that when that alias is used from within the Client Script (or a module used in a Client Script) that instead of B it points to C.
I got it to work when the alias is called directly from the User Event and Client Scripts. I did this by adding the Client Script in the "map" part of the AMD config. But it doesn't work when module A calls the alias.
My AMD config basically looks like this:
{
paths: {
"foo": "modules/B"
},
map: {
"SuiteScripts/ClientScript": {
"foo": "modules/C"
}
}
}
I have also tried passing an array in paths, since according to the documentation that works as a failover. But I then simply get "unexpected error has occured" with the User Event. In the Client Script I Get "d.split is not a function" and then it fails to load the script. Interesting side note here is that when the module that doesn't load in the Client Script is the first element in the Array I get this error. But when the module that works is the first element, everything works and that module is being loaded.