has anyone encountered this error on the API2.0 sc...
# general
r
has anyone encountered this error on the API2.0 scripts
currently netsuite's define is being used by unexpecting 3rd party libraries
the next thing to use a require after a 3rd party library uses define breaks
r
the weird thing is im not getting issues in sandbox. this is only happening in prod
and i still don't completely understand what the replies above mean...
b
smart external libraries know how to handle themselves in an amd environment
they do things like:
Copy code
if (typeof define == "function" && define.amd) // AMD
    define(["../../lib/codemirror"], mod);
that is an anonymous define function, there is no id identifier. There is only a dependency list and a factory function
anonymous define functions are not meant to be used at the top level context of the window
they are supposed to be in the dependency list of another require or define
when an anonymous define function is used inappropriately like this, the next call to the require function generates the error that you see
j
@battk is there anything we can do on our end or is this a case where we need to wait for NetSuite to fix.
b
if you use 3rd party libraries, remove any define statements that look like the example I gave
additionally for you, I think the Nanobar library comes from drag and drop, you may need to uninstall it
otherwise wait for NetSuite
j
So for us it's jQuery here's the first block of code from the library what can I change it to
function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e(jQuery)})(function(e){
b
im gonna avoid giving advice on jQuery. JQuery is included by NetSuite so I'm not sure how the replacement should go
j
ok I appreciate that thanks
t
How would we go about working around this if we have a custom script that starts with:
Copy code
define([
		'N/ui/dialog', 'N/search'
], function(dialog, search) {
b
Unless you are including that via a script tag, you do nothing