From 525086009d3d4906cd600fd7ac5775d79abd0c19 Mon Sep 17 00:00:00 2001 From: Ian Date: Fri, 4 Aug 2023 14:48:02 -0400 Subject: [PATCH] (fix) Resolve some errors that appear when an app has empty routes --- packages/shell/esm-app-shell/src/run.ts | 3 ++- packages/tooling/openmrs/src/commands/assemble.ts | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/shell/esm-app-shell/src/run.ts b/packages/shell/esm-app-shell/src/run.ts index 34ae57e12..5926500c3 100644 --- a/packages/shell/esm-app-shell/src/run.ts +++ b/packages/shell/esm-app-shell/src/run.ts @@ -142,7 +142,8 @@ async function preloadScripts() { ]); window.installedModules.map(async ([module]) => { - importDynamic(module, undefined, { importMap }); + // we simply swallow the error here since this is only a preload + importDynamic(module, undefined, { importMap }).catch(); }); } diff --git a/packages/tooling/openmrs/src/commands/assemble.ts b/packages/tooling/openmrs/src/commands/assemble.ts index a82305f5b..280239c04 100644 --- a/packages/tooling/openmrs/src/commands/assemble.ts +++ b/packages/tooling/openmrs/src/commands/assemble.ts @@ -250,7 +250,10 @@ export async function runAssemble(args: AssembleArgs) { logWarn( `Routes file ${appRoutes} does not exist. We expect that routes file to be defined by ${esmName}. Note that this means that no pages or extensions for ${esmName} will be available.` ); - routes[esmName] = {}; + + if (routes.hasOwnProperty(esmName)) { + delete routes[esmName]; + } } importmap.imports[esmName] = `${publicUrl}/${dirName}/${fileName}`;