require vs define? why one vs the other? Thanks,
# suitescript
j
require vs define? why one vs the other? Thanks,
e
require
is only for debugging or console. For actual script modules, you will use
define
j
ok, that's what I thought
I guess we use require to work in the console...? https://stoic.software/effective-suitescript/8-ss2-console/
You just answered this 😄 In order to work with a 2.0 module in the console, we need to import it into the console context first. We do that using the 
require
e
Right
I generally do something like
Copy code
require(["N/search"], (module) => s = module);
then
s
is the search module
j
ok 👍
w
I learned from battk that you can get all modules in a sweep with this:
Copy code
require(['N'], (N) => {Object.assign(window, N)})