Skip to content

Commit

Permalink
(fix) ensure we only load JS on the import map (#506)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibacher authored Aug 15, 2022
1 parent dfb0fb7 commit ca35053
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/shell/esm-app-shell/src/load-modules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,18 @@
export async function loadModules(modules: Record<string, string>) {
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);
});
} 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)];
Expand Down

0 comments on commit ca35053

Please sign in to comment.