Skip to content

Commit

Permalink
fix: fix dynamic import loading error detection
Browse files Browse the repository at this point in the history
Fix ARGOS-BROWSER-9P
  • Loading branch information
gregberge committed Dec 24, 2024
1 parent cf5a06d commit 32658e7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions apps/frontend/src/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,19 @@ function Root() {
*/
const DYNAMIC_IMPORT_MODULE_FAILED_TO_LOAD = [
// Blink
"Failed to fetch",
/Failed to fetch/,
// Firefox
"error loading dynamically imported module",
/error loading dynamically imported module/,
// Safari
"Importing a module script failed.",
/Importing a module script failed./,
];

function checkIsFailedToFetchError(error: unknown) {
return (
error instanceof Error &&
DYNAMIC_IMPORT_MODULE_FAILED_TO_LOAD.includes(error.message)
DYNAMIC_IMPORT_MODULE_FAILED_TO_LOAD.some((regex) =>
regex.test(error.message),
)
);
}

Expand Down

0 comments on commit 32658e7

Please sign in to comment.