fix(presentation): classify WebKit and Vite CSS preload chunk failures (R-8.2)

isChunkLoadFailure only knew the Chromium/Firefox wording, so Safari's
"Importing a module script failed." and Vite's "Unable to preload CSS for …"
were treated as ordinary render defects and never reached recoverChunk.
Both strings are now recognized.

Vite dispatches vite:preloadError and, unless a listener calls
preventDefault(), rethrows the same error into the dynamic import. That
rejection reaches the route's ChunkRecoveryBoundary, so no listener in
bootstrap/main.tsx was added: a listener that reloads would bypass the
reload-once guard, and one that prevents the default would swallow the
error.

Verified: RED "recognizes the WebKit module failure and the Vite CSS
preload failure" (false) and "recovers when Vite rethrows a
vite:preloadError into the lazy import" (recover not called, no failure
surface) failed before and pass after. check:architecture,
check:types:app, check:types:test, lint, test:component pass; test:unit
passes except the pre-existing removal-fixture test (needs generated
artifacts/ files absent from a fresh worktree).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
DongHyeonka
2026-09-24 12:39:51 +09:00
co-authored by Claude Opus 5.5
parent ad2b733ae9
commit 900659b32c
2 changed files with 47 additions and 1 deletions
@@ -32,7 +32,11 @@ export function isChunkLoadFailure(error: unknown): boolean {
value.includes("chunkloaderror") ||
value.includes("loading chunk") ||
value.includes("dynamically imported module") ||
value.includes("failed to fetch module script")
value.includes("failed to fetch module script") ||
// WebKit's wording for the same failed dynamic import.
value.includes("importing a module script failed") ||
// Vite rethrows a `vite:preloadError` into the import unless prevented.
value.includes("unable to preload css")
);
}