init() inside onMount in your root layout so it only runs in the browser:
onMount only runs on the client, so init() is never called during SSR. No extra guard needed.Install Tracelit in a Svelte or SvelteKit project using onMount in the root layout. SSR-safe and automatic route tracking included.