How can I access a third party javascript library inside a SCA SuiteScript file (a SuiteScript Service)?
For example; I have added the third party library js-sha256
to my SCA project in:
MyProjectRoot/
Modules/
third_parties/
js-sha256@1.0.0/
..contains the library files
ns.package.json
My service simply tries to import the library:
function service (request)
{
'use strict';
var sha256 = require('js-sha256'); // error occurs here when service is run
...
When the service runs it responds with:
{"errorStatusCode":"500","errorCode":"JS_EXCEPTION","errorMessage":"Error: No js-sha256"}
Any advice how I can use a third party library in my SuiteScript Service? How do I set it up?
Relevant Information:
- I have done a full deploy but it looks like the third party library isn't on the server in File Cabinet.
My
js-sha256@1.0.0/ns.package.json
content is:{ "gulp": { "javascript": [ "src/sha256.js" ] } , "jshint": "false" }