The previous configuration attempted to redefine the read-only navigator.serviceWorker
property, which caused runtime errors. Instead, we now handle service worker
availability through the transform plugin, which safely removes service worker
code in Electron and PyWebView builds.
This fixes the error:
"Cannot set property serviceWorker of #<Navigator> which has only a getter"
Technical changes:
- Removed navigator.serviceWorker from define section
- Rely on existing transform plugin to handle service worker code removal
- Maintains existing PWA functionality for web builds while properly
disabling it for desktop builds
- Properly disable service workers in electron builds
- Add CSP headers for electron security
- Fix path resolution in electron context
- Improve preload script error handling and IPC setup
- Update build scripts for better electron/capacitor compatibility
- Fix router path handling in electron context
- Remove electron-builder dependency
- Streamline build process and output structure
This change improves the stability and security of electron builds while
maintaining PWA functionality in web builds. Service workers are now
properly disabled in electron context, and path resolution issues are
fixed.
- Add dedicated electron build scripts for each platform
- Configure Vite rollup options for electron builds
- Update electron-builder configuration with proper app metadata
- Add clean script and rimraf dependency
- Set proper appId and build settings for production builds
- Enable asar packaging for better security
Previous error:
Error: The following dependencies are imported but could not be resolved:
dexie-export-import/dist/import (imported by /Users/jason/dev/src/trent/crowd-funder-for-time-pwa/src/views/AccountViewView.vue?id=0)
Are they installed?
at file:///Users/jason/dev/src/trent/crowd-funder-for-time-pwa/node_modules/vite/dist/node/chunks/dep-DJaaTb_D.js:52506:23
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async file:///Users/jason/dev/src/trent/crowd-funder-for-time-pwa/node_modules/vite/dist/node/chunks/dep-DJaaTb_D.js:51972:38