From ee091d0dbd089ec79f070aedf8c1f857b7a55839 Mon Sep 17 00:00:00 2001 From: Aakansha Doshi Date: Sat, 9 Nov 2024 21:45:37 +0530 Subject: [PATCH] build: add a flag VITE_APP_ENABLE_PWA for enabling pwa in dev environment (#8784) * build: add a flag VITE_APP_ENABLE_PWA for enabling pwa in dev environment * fix * set VITE_ENABLE_PWA to false in .env.development --- .env.development | 3 +++ excalidraw-app/vite-env.d.ts | 3 +++ excalidraw-app/vite.config.mts | 3 ++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.env.development b/.env.development index badc209a2..c2e84da60 100644 --- a/.env.development +++ b/.env.development @@ -38,6 +38,9 @@ VITE_APP_COLLAPSE_OVERLAY=true # Set this flag to false to disable eslint VITE_APP_ENABLE_ESLINT=true +# Enable PWA in dev server +VITE_APP_ENABLE_PWA=true + VITE_APP_PLUS_EXPORT_PUBLIC_KEY='MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAm2g5T+Rub6Kbf1Mf57t0 7r2zeHuVg4dla3r5ryXMswtzz6x767octl6oLThn33mQsPSy3GKglFZoCTXJR4ij ba8SxB04sL/N8eRrKja7TFWjCVtRwTTfyy771NYYNFVJclkxHyE5qw4m27crHF1y diff --git a/excalidraw-app/vite-env.d.ts b/excalidraw-app/vite-env.d.ts index 3230946fb..ade60e859 100644 --- a/excalidraw-app/vite-env.d.ts +++ b/excalidraw-app/vite-env.d.ts @@ -29,6 +29,9 @@ interface ImportMetaEnv { // Enable eslint in dev server VITE_APP_ENABLE_ESLINT: string; + // Enable PWA in dev server + VITE_APP_ENABLE_PWA: string; + VITE_APP_PLUS_LP: string; VITE_APP_PLUS_APP: string; diff --git a/excalidraw-app/vite.config.mts b/excalidraw-app/vite.config.mts index 0345c8ee7..2d18f8c06 100644 --- a/excalidraw-app/vite.config.mts +++ b/excalidraw-app/vite.config.mts @@ -80,7 +80,7 @@ export default defineConfig(({ mode }) => { registerType: "autoUpdate", devOptions: { /* set this flag to true to enable in Development mode */ - enabled: false, + enabled: envVars.VITE_APP_ENABLE_PWA === "true", }, workbox: { @@ -169,6 +169,7 @@ export default defineConfig(({ mode }) => { }, ], start_url: "/", + id:"excalidraw", display: "standalone", theme_color: "#121212", background_color: "#ffffff",