Update Vite configuration and enhance error handling in Svelte components
- Added 'tldts' and 'tldts-core' to the Vite SSR noExternal configuration. - Refactored error handling in +error.svelte and auth-failed/+page.svelte to use a goHome function for navigation instead of href attributes.
This commit is contained in:
@@ -7,6 +7,10 @@
|
||||
import * as Avatar from '@cio/ui/base/avatar';
|
||||
|
||||
const errorCode = $derived(new URLSearchParams(page.url.search).get('error'));
|
||||
|
||||
function goHome() {
|
||||
window.location.href = '/';
|
||||
}
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
@@ -36,6 +40,6 @@
|
||||
find more information about the error here.
|
||||
</Card.Description>
|
||||
|
||||
<Button href="/" class="">Go Home</Button>
|
||||
<Button onclick={goHome} class="">Go Home</Button>
|
||||
</div>
|
||||
</AuthUI>
|
||||
|
||||
@@ -7,6 +7,10 @@
|
||||
const isNotFound = $derived(page.status === 404);
|
||||
|
||||
console.error('error message', page.error?.message);
|
||||
|
||||
function goHome() {
|
||||
window.location.href = '/';
|
||||
}
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
@@ -23,7 +27,7 @@
|
||||
showLogo={true}
|
||||
>
|
||||
<div class="flex gap-2">
|
||||
<Button href="/">Go Home</Button>
|
||||
<Button onclick={goHome}>Go Home</Button>
|
||||
</div>
|
||||
</Empty>
|
||||
{:else}
|
||||
@@ -37,7 +41,7 @@
|
||||
>
|
||||
<div class="flex gap-2">
|
||||
<Button href="https://classroomio.com/tools" variant="secondary">Try Free tools</Button>
|
||||
<Button href="/">Go Home</Button>
|
||||
<Button onclick={goHome}>Go Home</Button>
|
||||
</div>
|
||||
</Empty>
|
||||
{/if}
|
||||
|
||||
@@ -20,7 +20,7 @@ export default ({ mode }) => {
|
||||
sourcemap: false
|
||||
},
|
||||
ssr: {
|
||||
noExternal: ['svelte-sonner', 'layerchart', 'svelte-toolbelt']
|
||||
noExternal: ['svelte-sonner', 'layerchart', 'svelte-toolbelt', 'tldts', 'tldts-core']
|
||||
},
|
||||
optimizeDeps: {
|
||||
entries: ['src/routes/**/+*.{js,ts,svelte}'],
|
||||
|
||||
Reference in New Issue
Block a user