Chore: Prevent preloaded plugins from crashing Grafana (#41490)

* if a plugin fails to load, we will not crash grafana.

* preventing the preloaded plugings to crash the whole app on failure.

* updated to unkown.

* fixed issue with angular by moving the preloadPlugin import to the same row as we did import the importPluginModule.
This commit is contained in:
Marcus Andersson
2021-11-10 19:06:55 +01:00
committed by GitHub
parent e0a60cf459
commit e926126d63
3 changed files with 18 additions and 9 deletions

View File

@ -78,7 +78,6 @@ grafanaRuntime.SystemJS.config({
function exposeToPlugin(name: string, component: any) {
grafanaRuntime.SystemJS.registerDynamic(name, [], true, (require: any, exports: any, module: { exports: any }) => {
console.log('registerDynamic callback', name);
module.exports = component;
});
}
@ -184,7 +183,7 @@ export async function importPluginModule(path: string, version?: string): Promis
if (typeof builtIn === 'function') {
return await builtIn();
} else {
return Promise.resolve(builtIn);
return builtIn;
}
}
return grafanaRuntime.SystemJS.import(path);