Skip to content

Commit

Permalink
electron: Fix problem of having multiple windows created on dev mode
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaellehmkuhl committed Oct 10, 2024
1 parent f7251b2 commit 3dc913d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import vue from '@vitejs/plugin-vue'
import { defineConfig } from 'vite'
import electron from 'vite-plugin-electron'
import electron, { startup, treeKillSync } from 'vite-plugin-electron'
import { VitePWA } from 'vite-plugin-pwa'
import vuetify from 'vite-plugin-vuetify'

Expand All @@ -15,6 +15,14 @@ export default defineConfig({
outDir: 'dist/electron',
},
},
onstart: () => {
// @ts-ignore: process.electronApp exists in vite-plugin-electron but not in the types
if (process.electronApp) {
// @ts-ignore: process.electronApp.pid exists in vite-plugin-electron but not in the types
treeKillSync(process.electronApp.pid)
}
startup()
},
}),
vue(),
vuetify({
Expand Down

0 comments on commit 3dc913d

Please sign in to comment.