Loading lodash or other external JS libraries

Monib Ahmed's icon

Hi, I'm trying to load some external JS libraries. Can you advise me what is the recommended way of doing this?

I've tried including the paths in Files Search Path, and the paths are showing up

MacOS:/Users/monibahmed/node_modules/lodash
MacOS:/Users/monibahmed/node_modules/lodash/fp

But the following post "undefined" in the console:

var lodash = require("lodash");
post(lodash.VERSION+'\n')

nick rothwell | project cassiel's icon

Load it by message:[script npm install lodash] and use in JS by const _ = require('lodash')
Seems to work fine here.

Monib Ahmed's icon

Hi, yes the node.script object works fine with Lodash, but not the js object?

thanks

nick rothwell | project cassiel's icon

Ah, no. [js] and [jsui] are strictly limited in scope.

Monib Ahmed's icon

Thank you! I guess I’ll start using node.