diff --git a/src/index.tsx b/src/index.tsx index d0f333ec..ea8c39cb 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,11 +1,14 @@ import { StrictMode } from "react"; import { createRoot } from "react-dom/client"; import ExcalidrawApp from "./excalidraw-app"; +import { registerSW } from "virtual:pwa-register"; import "./excalidraw-app/sentry"; window.__EXCALIDRAW_SHA__ = import.meta.env.VITE_APP_GIT_SHA; const rootElement = document.getElementById("root")!; const root = createRoot(rootElement); +registerSW(); + root.render( diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts index 8843ecc3..624f4cf4 100644 --- a/src/vite-env.d.ts +++ b/src/vite-env.d.ts @@ -1,8 +1,7 @@ /// -/// +/// /// /// - interface ImportMetaEnv { // The port to run the dev server VITE_APP_PORT: string; diff --git a/vite.config.ts b/vite.config.ts index fe3c2c23..4a4d72e3 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -53,6 +53,7 @@ export default defineConfig({ svgrPlugin(), ViteEjsPlugin(), VitePWA({ + registerType: "autoUpdate", devOptions: { /* set this flag to true to enable in Development mode */ enabled: false,