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