I tried it as a relative path `import * as _ from ...
# suitescript
k
I tried it as a relative path
import * as _ from './underscore';
and get the error
org.mozilla.javascript.EcmaError: TypeError: Cannot call method "find" of undefined
b
upload underscore.js into the file cabinet. Use
import * as _ from '/absolute/path/in/file/cabinet/underscore.js';
you can use a relative path after you get the import correct
k
ok, WebStorm will throw a fit but I think it'll be ok 🙂
b
i just want to emphasize that you upload it yourself
k
yeah I did
not entirely sure I uploaded the right file, but I did upload it
nope, even with absolute path
org.mozilla.javascript.EcmaError: TypeError: Cannot call method "find" of undefined
it's not having trouble finding the file
just the function in the file
I think maybe the script isn't set up the way NS likes
maybe the wrong file?
b
what does your compiled code look like?
k
I'm using the Node.js version from here https://underscorejs.org/
It's too long to paste here but here's the start of it
oh my compiled code
Ah ok, webstorm helpfully didn't include it
I have an idea
b
that underscore wont work with netsuite
netsuite is out of spec on their amd implementation
can't define a named module the way underscore has
its more popular anyways
k
ah ok that's what I was thinking about this underscore version because it's definitely exporting find just not the way NS can find it
Beautiful, worked first try!
You've been telling me for ages I should use lodash. I'm glad I finally decided to listen 😄
s
use lodash over underscore.
d
how about using unpkg?