I am trying to use Sweetalerts but I am getting ``...
# suitescript
h
I am trying to use Sweetalerts but I am getting
Copy code
Fail to evaluate script: org.mozilla.javascript.EcmaError: ReferenceError: "WeakMap" is not defined. (/SuiteScripts/lib/sweetalert2.all.min.js#1)
on production, on sandbox it is working. Did anyone have this issue ?
j
🤦 I have seen NetSuite server perform static analysis on client scripts that you attach to the form using
form.clientScriptModulePath/FileId
. It also checks anything imported in the
define
statement of the client script. Since the NetSuite server JS engine has not been updated for the better part of a decade it is missing new APIs released since then, in this case WeakMap. I have been able to circumvent the static analysis by bringing in the dependencies that use the newer APIs with
require
.