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