Files
Graphite/frontend/src/main.ts
Keavon Chambers 1a06d3ea80 Improve PWA support with service worker-based offline caching (#3985)
* Implement the service worker for cached offline mode

* Improve pre-loaded font menu preview visualization

* Code review fixes

* Simplify Response construction

* Attempt to fix ERR_FAILED when reloading page on CF Pages

* Reject service worker install if any precache fetch fails
2026-04-02 18:14:40 -07:00

20 lines
738 B
TypeScript

// This file is the browser's entry point for the JS bundle
import { mount, unmount } from "svelte";
import App from "/src/App.svelte";
import { registerServiceWorker } from "/src/utility-functions/service-worker";
// Register the service worker, except in dev mode and native (CEF) builds
if (!import.meta.env.DEV && import.meta.env.MODE !== "native" && "serviceWorker" in navigator) {
registerServiceWorker();
}
document.body.setAttribute("data-app-container", "");
const app = mount(App, { target: document.body });
// Ensure the old component tree is properly torn down during HMR so all onDestroy hooks fire (which clean up IO managers, state providers, etc.)
import.meta.hot?.dispose(() => unmount(app));
export default app;