forked from jsnbuchanan/crowd-funder-for-time-pwa
Remove manual service worker registration; rely on VitePWA auto-registration
- Deleted src/registerServiceWorker.ts and all related imports - Cleaned up WebPlatformService and main.web.ts to remove manual SW logic - Updated VitePWA config for correct dev/prod SW handling - Fixed missing FontAwesome download icon in PWA prompt - Updated docs to reflect new PWA registration approach PWA now works reliably in all web environments with zero manual SW code.
This commit is contained in:
@@ -17,17 +17,8 @@ export async function createBuildConfig(platform: string): Promise<UserConfig> {
|
||||
const isElectron = platform === "electron";
|
||||
const isNative = isCapacitor || isElectron;
|
||||
|
||||
// Set platform and configure PWA based on environment or platform
|
||||
// Set platform - PWA is always enabled for web platforms
|
||||
process.env.VITE_PLATFORM = platform;
|
||||
|
||||
// Use .env file value if set, otherwise default based on platform
|
||||
if (process.env.VITE_PWA_ENABLED === undefined) {
|
||||
process.env.VITE_PWA_ENABLED = isNative ? 'false' : 'true';
|
||||
}
|
||||
|
||||
if (isNative) {
|
||||
process.env.VITE_PWA_ENABLED = 'false';
|
||||
}
|
||||
|
||||
return {
|
||||
base: "/",
|
||||
@@ -63,7 +54,7 @@ export async function createBuildConfig(platform: string): Promise<UserConfig> {
|
||||
define: {
|
||||
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
|
||||
'process.env.VITE_PLATFORM': JSON.stringify(platform),
|
||||
'process.env.VITE_PWA_ENABLED': JSON.stringify(!isNative),
|
||||
// PWA is always enabled for web platforms
|
||||
__dirname: JSON.stringify(process.cwd()),
|
||||
__IS_MOBILE__: JSON.stringify(isCapacitor),
|
||||
__IS_ELECTRON__: JSON.stringify(isElectron),
|
||||
|
||||
Reference in New Issue
Block a user