`define` error back again? getting undefined varia...
# suitescript
k
define
error back again? getting undefined variables on scripts that were working perfectly yesterday
r
@Kris Jones Would you mind posting your code?
I haven't seen that error before, just want see if for my own curiosity.
j
Yeah, the same issue is popping up. Require.js, Jquery, and CodeMirror.js sometimes not loading properly. My users have had a better experience in Firefox over Chrome...
k
@Rehan a simple form portlet with inline html that has an external script (e.g.,
<script src="<https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.3/Chart.min.js>"></script>
), then trying to use the
Chart
variable that script exposes
console errors also include
Mismatched anonymous define() module:
j
@Kris Jones, are you logged in under a custom role?
k
full access
j
ok, just wondering. I had some people switch to standard roles and it fixed it for them... sigh.
k
and now the problem has gone away 🤷
very weird
b
is your portlet suitescript 2.0?
r
I was getting the same console errors viewing projects. Didn't appear to affect anything tho
k
@battk yes
b
you probably don't want to use the script tag. Put Chart.js in the file cabinet and add it to your dependencies of your client script
Netsuite is playing with the load order of their require.js and deleting and adding back define
This happens asynchronously, which is why you are seeing the strangeness in it sometimes working and sometimes not
k
I tried going that route the last time this issue was happening (not knowing it was a universal problem), but had quite a bit of difficulty I put Chart.js on the file cabinet, linked the client script to the portlet, then set up the client script to include the file cabinet Chart.js (and jQuery), used a pageInit handler to have all the jquery click events etch attach when the portlet loads aaand... couldn't get it to work 😕
Chart
undefined and additional problems calling jQuery methods not sure if I fudged something up with the above approach though (but I definitely do think it's more robust and easier to manage, for sure)
b
if you want to try again, I can try helping you out. It doesn't look like Chart.js has anything in it that prevents its use in NetSuite
k
@battk I may take you up on that if nothing else gets thrown my way today 🙂 thanks!
d
@battk - If you're making a custom portlet, you may look at the highcharts.js library. Netsuite loads it native on all dashboard pages. That's what we're using (and we love Highcharts). Of course, if they ever move to a different charting system, we'll have to rethink it.