Service workers
Edit this pageTo register a service worker:
- Place your service-worker file in the
publicdirectory (e.g.,public/sw.js), making it available at the root URL (/sw.js). - Add registration logic to the
entry-client.tsxfile.
// @refresh reloadimport { mount, StartClient } from "@solidjs/start/client";
mount(() => <StartClient />, document.getElementById("app")!);
if ("serviceWorker" in navigator && import.meta.env.PROD) { window.addEventListener("load", () => { navigator.serviceWorker.register("/sw.js"); });}