diff --git a/public/app/features/plugins/plugin_loader.ts b/public/app/features/plugins/plugin_loader.ts index c594b4f0a13..0a2172f0b9d 100644 --- a/public/app/features/plugins/plugin_loader.ts +++ b/public/app/features/plugins/plugin_loader.ts @@ -29,6 +29,17 @@ const systemJSPrototype: SystemJSWithLoaderHooks = SystemJS.constructor.prototyp // the content of the plugin code at runtime which can only be done with fetch/eval. systemJSPrototype.shouldFetch = () => true; +const originalImport = systemJSPrototype.import; +// Hook Systemjs import to support plugins that only have a default export. +systemJSPrototype.import = function (...args: Parameters) { + return originalImport.apply(this, args).then((module) => { + if (module && module.__useDefault) { + return module.default; + } + return module; + }); +}; + const systemJSFetch = systemJSPrototype.fetch; systemJSPrototype.fetch = function (url: string, options?: Record) { return decorateSystemJSFetch(systemJSFetch, url, options);