From fff96dc90256913e450eb7972f114a3d4fb42bf4 Mon Sep 17 00:00:00 2001 From: Ian Date: Mon, 15 Aug 2022 12:47:30 -0400 Subject: [PATCH] (fix) ensure we only load JS on the import map --- packages/shell/esm-app-shell/src/load-modules.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/shell/esm-app-shell/src/load-modules.ts b/packages/shell/esm-app-shell/src/load-modules.ts index 3f49c8b9b..e9b723c5d 100644 --- a/packages/shell/esm-app-shell/src/load-modules.ts +++ b/packages/shell/esm-app-shell/src/load-modules.ts @@ -21,6 +21,10 @@ export async function loadModules(modules: Record) { return Promise.all( Object.entries(modules).map(async ([name, url]) => { + if (!url || !url.match(/\.js$/)) { + return [name, {}]; + } + try { await new Promise((resolve, reject) => { loadScript(name, url, resolve, reject); @@ -28,7 +32,7 @@ export async function loadModules(modules: Record) { } catch { // on an error, loadScript will log an appropriate message // we bail here so we don't break the application - return [name, []]; + return [name, {}]; } const app: any = window[slugify(name)];