Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/hooks.client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type { HandleClientError } from '@sveltejs/kit'

export const handleError: HandleClientError = ({ error }) => {
// When a new deployment happens, old JS chunks are gone.
// Detect this and reload the page to get fresh assets.
if (error instanceof TypeError && error.message.includes('Importing a module script failed')) {
window.location.reload()
return
}
}