3

I am wondering if it is possible to reference node modules in SuiteScript. For example, I am aware that I can create a third party library in the file cabinet and reference the moment.js file. However, is it possible to do an npm install moment on your suitecloud project and then have access moment in that script by simply importing it as you would in Node?

2 Answers2

0

Actually you cannot use Node.js inside suite script. But you can trigger scripts from Node.js. Example if you want to create a record from a json file, you can trigger node.js to pass the json to a Map/Reduce or RestLet script.

0

is it possible to do an npm install moment on your suitecloud project and then have access moment in that script by simply importing it as you would in Node?

Yes and no. What you could do in this case is to copy the required .js files along with the SuiteScript files when doing the deployment, having in mind that the SS files would be referencing the library using a relative path.

All of this could be programmed as a task in node (or maybe webpack), which would all execute in your machine, and then upload the results to NetSuite.

felipechang
  • 916
  • 6
  • 14