fix: disable PWA for Capacitor builds

Updates PWA configuration to:
- Disable PWA features for Capacitor builds
- Add @capacitor/app dependency
- Update environment variable handling in build config

This prevents conflicts between PWA and native app functionality
when building for mobile platforms.

Technical changes:
- Add isCapacitor check to PWA disable logic
- Update VITE_PWA_ENABLED environment variable definition
- Add @capacitor/app to package dependencies
This commit is contained in:
Matthew Raymer
2025-02-18 11:54:42 +00:00
parent 74a412745a
commit fbdf72557c
5 changed files with 21 additions and 2 deletions

View File

@@ -17,7 +17,7 @@ export async function createBuildConfig(mode: string) {
const isCapacitor = mode === "capacitor";
const isPyWebView = mode === "pywebview";
if (isElectron || isPyWebView) {
if (isElectron || isPyWebView || isCapacitor) {
process.env.VITE_PWA_ENABLED = 'false';
}
@@ -35,7 +35,7 @@ export async function createBuildConfig(mode: string) {
},
define: {
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
'process.env.VITE_PWA_ENABLED': JSON.stringify(!(isElectron || isPyWebView)),
'process.env.VITE_PWA_ENABLED': JSON.stringify(!(isElectron || isPyWebView || isCapacitor)),
__dirname: isElectron ? JSON.stringify(process.cwd()) : '""',
},
resolve: {