| 505 | * across major browsers for lazy route component handling. |
| 506 | */ |
| 507 | export function isModuleNotFoundError(error: any): boolean { |
| 508 | // chrome: "Failed to fetch dynamically imported module: http://localhost:5173/src/routes/posts.index.tsx?tsr-split" |
| 509 | // firefox: "error loading dynamically imported module: http://localhost:5173/src/routes/posts.index.tsx?tsr-split" |
| 510 | // safari: "Importing a module script failed." |
| 511 | if (typeof error?.message !== 'string') return false |
| 512 | return ( |
| 513 | error.message.startsWith('Failed to fetch dynamically imported module') || |
| 514 | error.message.startsWith('error loading dynamically imported module') || |
| 515 | error.message.startsWith('Importing a module script failed') |
| 516 | ) |
| 517 | } |
| 518 | |
| 519 | export function isPromise<T>( |
| 520 | value: Promise<Awaited<T>> | T, |