Plugin module is missing Datasource constructor

I’m trying to construct my own datasource plugin based on example app and simple json datasource. When I try do add my datasource in grafana I receive the “Plugin module is missing Datasource constructor” error. My datasource.js code is:

export default class ExampleAppDatasource {

	constructor(instanceSettings, $q, backendSrv, templateSrv) {
	    this.type = instanceSettings.type;
	    this.url = instanceSettings.url;
	    this.name = instanceSettings.name;
	    this.q = $q;
	    this.backendSrv = backendSrv;
	    this.templateSrv = templateSrv;
	    this.withCredentials = instanceSettings.withCredentials;
	    this.headers = {'Content-Type': 'application/json'};
	    if (typeof instanceSettings.basicAuth === 'string' && instanceSettings.basicAuth.length > 0) {
	      this.headers['Authorization'] = instanceSettings.basicAuth;
	    }
  	}


	query(options) {
		return this.q(function(resolve, reject) {
			var result = {
			    data : [
			      {
			        "target":"upper_75",
			        "datapoints":[
			          [622.0, 1450754160], [365.0, 1450754220], [42.0, 1450754280], [240.0, 1450754340], [401.0, 1450754400], [364.0, 1450754460], [325.0, 1450754520], [6.0, 1450754580], [267.0, 1450754640]
			        ]
			      }
			    ]
			}
		  resolve(result)
		});
	}

	testDatasource() {
		return { status: "success", message: "Data source is working", title: "Success" };
	}
}

What does your module.js look like?

Like this:

import {ExampleAppDatasource} from  './datasource';

class ExampleAppConfigCtrl {}
ExampleAppConfigCtrl.template = '<datasource-http-settings current="ctrl.current"></datasource-http-settings>';

export {
  ExampleAppDatasource,
  ExampleAppConfigCtrl as ConfigCtrl
};

The datasource should be exported as Datasource

My module.js is like this now:

import {ExampleAppDatasource} from  './datasource';

class ExampleAppConfigCtrl {}
ExampleAppConfigCtrl.template = '<datasource-http-settings current="ctrl.current"></datasource-http-settings>';

export {
  ExampleAppDatasource as Datasource,
  ExampleAppConfigCtrl as ConfigCtrl
};

and the same error persist. I run the grunt after the modification. I need to run my grafana image docker again?

yes, probably depends on how you mount & install the plugin inside the container