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