diff --git a/public/app/features/plugins/plugin_loader.ts b/public/app/features/plugins/plugin_loader.ts index 86fa82d8897..7cafe296a60 100644 --- a/public/app/features/plugins/plugin_loader.ts +++ b/public/app/features/plugins/plugin_loader.ts @@ -28,12 +28,14 @@ SystemJS.addImportMap({ imports }); const systemJSPrototype: SystemJSWithLoaderHooks = SystemJS.constructor.prototype; -// This instructs SystemJS to load a plugin using fetch and eval if it returns a truthy value, otherwise it will load the plugin using a script tag. -// We only want to fetch and eval plugins that are hosted on a CDN or are Angular plugins. +// This instructs SystemJS to load plugin assets using fetch and eval if it returns a truthy value, otherwise +// it will load the plugin using a script tag. We only want to fetch and eval files that are +// hosted on a CDN, are related to Angular plugins or are not js files. systemJSPrototype.shouldFetch = function (url) { const pluginInfo = getPluginFromCache(url); + const jsTypeRegEx = /^[^#?]+\.(js)([?#].*)?$/; - return isHostedOnCDN(url) || Boolean(pluginInfo?.isAngular); + return isHostedOnCDN(url) || Boolean(pluginInfo?.isAngular) || !jsTypeRegEx.test(url); }; const originalImport = systemJSPrototype.import;