vite-plugin-electron icon indicating copy to clipboard operation
vite-plugin-electron copied to clipboard

openDevTools fails with "Renderer process crashed"

Open itsmattkc opened this issue 1 month ago • 1 comments

This is a really bizarre issue that I'm not sure how to diagnose any further.

When running Electron through Vite (npm run dev), I can't open dev tools (either through View > Toggle Developer Tools or win.webContents.openDevTools()). The message "Renderer process crashed" appears in the console and nothing else happens.

If I catch 'render-process-gone', I can get the following: { reason: 'crashed', exitCode: 134 }, but it doesn't seem super helpful (134 is just SIGABRT).

However, here's the bizarre part: if I start Electron separately, dev tools work fine. As in, if I initially start the server with npm run dev, ignore the Electron window that opens, and start a new one with node_modules/electron/dist/electron ., that instance has no problem opening dev tools and makes no mention of "Renderer process crashed".

Therefore, it seems the issue is specifically something to do with how Vite (or more specifically vite-plugin-electron) is launching Electron?

For reference, these are my package.json scripts:

  "scripts": {
    "dev": "vite",
    "build": "tsc -b && vite build",
    "lint": "eslint .",
    "preview": "vite preview"
  },

And this is the "electron" section in vite.config.ts (using import electron from 'vite-plugin-electron/simple'):

    electron({
      entry: [ 'electron/main.ts', 'electron/preload.ts' ],
    }),

Any help on this would be much appreciated.

itsmattkc avatar Oct 31 '25 17:10 itsmattkc

  • Possibly related to #264.

andersk avatar Nov 12 '25 19:11 andersk