import { mount } from "svelte"; import * as Sentry from "@sentry/browser"; // Errors only — no tracing, no replay. Without a DSN baked at build time // (VITE_SENTRY_DSN in .env.production) this is entirely inert. if (import.meta.env.VITE_SENTRY_DSN) { Sentry.init({ dsn: import.meta.env.VITE_SENTRY_DSN, environment: "production", // Facebook's in-app browser injects its own scripts (iabjs://) and // reports their failures as ours when the page unloads. denyUrls: [/^iabjs:\/\//], ignoreErrors: ["Java object is gone"], }); } // A page loaded before a deploy may ask for a chunk the deploy retired. // Vite reports the failed import here; one reload fetches the live bundle. // The flag keeps a broken build from reloading forever. window.addEventListener("vite:preloadError", (e) => { e.preventDefault(); try { if (sessionStorage.getItem("wizwar-reloaded")) return; sessionStorage.setItem("wizwar-reloaded", "1"); } catch { /* storage may be unavailable; reload anyway */ } location.reload(); }); try { sessionStorage.removeItem("wizwar-reloaded"); } catch { /* ignore */ } // /watch/ is the public share page — one turn, anyone may look. It // loads its own component so the full app (and its live socket appetite) // stays out of a shared link's way. const target = document.getElementById("app")!; const page = location.pathname.startsWith("/watch/") ? import("./SharePage.svelte") : import("./App.svelte"); page.then(({ default: Root }) => mount(Root, { target }));