hi all, i have a question about suitescript refere...
# suitescript
l
hi all, i have a question about suitescript referencing external libraries. according to the example, regular javascript uses this @azure/cosmos to talk to azure cosmos DB. I imagine netsuite server side doesn't know what @azure/cosmos is. in general, do we include such things to execute on netsuite's servers? thanks
e
@azure/cosmos
is an npm package. In general, to use a third-party library like this in NetSuite, you first need to obtain the built JS file(s) for the library, either by downloading them directly from the repo or installing via the
npm install
command. Then you need to upload those file(s) to the File Cabinet. Then you can include them in your SuiteScript modules:
Copy code
define(['SuiteScripts/lib/cosmos'], (cosmos) => {
  // ...
  const client = new cosmos.CosmosClient(/* ... */)
  // ...
})
I'm not familiar with this particular package, so I don't know exactly what files you'd need to upload
Have a video about the basic process here:

https://www.youtube.com/watch?v=BlUqPUI9ALo

Some libraries are more complicated though.
l
thank you for the video link. watching now. I have seen your other videos on youtube before. 🙏
❤️ 1