Skip to content

Restart does not close old Electron instance #251

@probablykasper

Description

@probablykasper

Problem

My app has a before-quit handler which waits for the webview to be ready. But when the plugin makes Electron restart, the webview page/code is gone, so it can't tell the app to finish quitting. This means I end up with many Electron instances running at the same time

Solution

Keep the Vite webpage loaded until the app quits

Workaround

Disable restarting:

onstart({ startup }) {
  if (process.electronApp) {
    console.log('\x1b[35mNot restarting\x1b[0m')
  } else {
    startup()
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions