mirror of
https://github.com/electron-vite/electron-vite-vue
synced 2025-01-19 11:56:36 +08:00
feat: exit the command when closing the application
This commit is contained in:
parent
8089ebcb90
commit
56b59c9702
@ -27,6 +27,7 @@ function watchMain(server) {
|
|||||||
VITE_DEV_SERVER_HOST: address.address,
|
VITE_DEV_SERVER_HOST: address.address,
|
||||||
VITE_DEV_SERVER_PORT: address.port,
|
VITE_DEV_SERVER_PORT: address.port,
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {import('vite').Plugin}
|
* @type {import('vite').Plugin}
|
||||||
*/
|
*/
|
||||||
@ -34,8 +35,15 @@ function watchMain(server) {
|
|||||||
name: 'electron-main-watcher',
|
name: 'electron-main-watcher',
|
||||||
writeBundle() {
|
writeBundle() {
|
||||||
clearConsole()
|
clearConsole()
|
||||||
electronProcess && electronProcess.kill()
|
|
||||||
|
if (electronProcess) {
|
||||||
|
electronProcess.removeAllListeners()
|
||||||
|
electronProcess.kill()
|
||||||
|
electronProcess = null
|
||||||
|
}
|
||||||
|
|
||||||
electronProcess = spawn(electron, ['.'], { stdio: 'inherit', env })
|
electronProcess = spawn(electron, ['.'], { stdio: 'inherit', env })
|
||||||
|
electronProcess.on('exit', process.exit)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user