"use client"; import { useEffect } from "react"; /** * Registers public/sw.js so the terminal can open offline. Production only: * in `next dev` the build assets are not content-hashed, and caching them * would serve stale code while developing. */ export default function ServiceWorkerRegister() { useEffect(() => { if (process.env.NODE_ENV !== "production" || !("serviceWorker" in navigator)) return; navigator.serviceWorker.register("/sw.js").catch(() => { // Unsupported or blocked: the app still works online. }); }, []); return null; }