I am currently getting an error when loading files after the initial page load that I have managed to trace back to the Google visualization library. When I deployed this page last year, it worked fine, but when I was adding to the page now, the error began appearing. Not sure when between then and now that this error actually sprang up as this page is not used by many and none of them have reported this to me. I was able to figure out that the globalDefQueue
is getting an anonymous module left in it from the initial load, which causes the future loads to error out. How do I go about solving this problem? I have seen here on SO people recommend just adding an onError override to require and leave it blank, but I'd rather not cripple the framework like that. I've tried googling and searching the chart forum itself, and I cannot see a way to properly load the library using require, which I'm hoping would solve the issue, but at the same time I have no idea if it would.
I am loading the require file and main as such: (This is my only script
tag)
<script type="text/javascript" src="<%=request.getContextPath()%>/scripts/app/lib/requirejs/require.js" data-main="<%=request.getContextPath()%>/scripts/app/src/init"></script>
init.js
:
require(['domReady!', 'angular', 'jquery', 'https://www.gstatic.com/charts/loader.js', 'app'], function (document, ng, $) {
'use strict';
...
google.charts.load("current", {"packages": ["line", "corechart"]});
google.charts.setOnLoadCallback(function () {
...
});
});
Specifically it is the call to load from the charts object that adds the new item to global stack anonymously. As this is a function being called from the library, there is no way that I know of for me to circumvent its loading mechanism with RequireJS.