24 lines
688 B
TypeScript
24 lines
688 B
TypeScript
import { StrictMode } from "react";
|
|
import { createRoot } from "react-dom/client";
|
|
import App from "./App";
|
|
import "./styles/index.css";
|
|
|
|
// PWA: register the service worker (production only — the dev server's caching
|
|
// would otherwise serve stale modules).
|
|
if ("serviceWorker" in navigator && import.meta.env.PROD) {
|
|
window.addEventListener("load", () => {
|
|
navigator.serviceWorker.register("/sw.js").catch(() => {
|
|
// Non-fatal: the app still works without the offline shell.
|
|
});
|
|
});
|
|
}
|
|
|
|
const container = document.getElementById("root");
|
|
if (!container) throw new Error("#root not found");
|
|
|
|
createRoot(container).render(
|
|
<StrictMode>
|
|
<App />
|
|
</StrictMode>
|
|
);
|