Upgrading from 2.5 to 4.6 -- Issues with requirejs in scripted dashboards

Hi there! We had a co-op write our originally setup a couple years ago. He did a great job for the amount of time we gave him. I’m now going back to try and clean up and upgrade his work to the latest version.

I’ve downloaded the code from github and can build and run just fine. My issue comes when I’m trying to load one of our scripted dashboards. He has this at the bottom of every scripted dashboard:

return function(callback) {
	requirejs(["/app/shared.js"], function(result){
		callbackFunction = callback;

I’m not sure what the purpose of this is for the Grafana flow. In main() he has:

        // dashboard setup
        // ... etc


And in the shared.js he has a bunch of global variables (dashboard and callbackFunction included) as well as a bunch of define(['file.js']) files for referencing methods inside of them I presume.

What happens when I try to navigate to the dashboard though is I’m getting a console error in the browser about not knowing what to do with requirejs. I’d read somewhere that requirejs was ripped out and replaced with systemjs maybe? I’m not exactly sure how to go about replacing it in our existing scripts though. Any ideas for how I can get this running?

Yes, use SystemJS.import() instead.