Skip to content

openDevTools fails with "Renderer process crashed" #285

@itsmattkc

Description

@itsmattkc

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions