electron-vite / electron-vite-vue

🥳 Really simple Electron + Vite + Vue boilerplate.

Home Page:https://electron-vite.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

如何在给启动的时候加上 --sourcemap --remote-debugging-port=9222 参数呢,想要调试主进程。或者如何开一个端口调试 然后从chrome devtools里调试呢

qiming97 opened this issue · comments

Describe the problem you confuse

如何在给启动的时候加上 --sourcemap --remote-debugging-port=9222 参数呢,想要调试主进程。或者如何开一个端口调试 然后从chrome devtools里调试呢

https://electron-vite.github.io/faq/debug.html

// vite.config.ts
import electron from 'vite-plugin-electron'

export default {
  plugins: [
    electron({
      entry: 'electron/main/index.ts',
      onstart({ startup }) {
        startup([
          '.',
          '--no-sandbox',
          '--sourcemap',
          // For Chrome devtools
          '--remote-debugging-port=9222',
        ])
      },
    }),
  ],
}
// vite.config.ts
import electron from 'vite-plugin-electron'

export default {
  plugins: [
    electron({
      entry: 'electron/main/index.ts',
      onstart({ startup }) {
        startup([
          '.',
          '--no-sandbox',
          '--sourcemap',
          // For Chrome devtools
          '--remote-debugging-port=9222', // for renderer process
+         '--inspect=9228', // for main process
        ])
      },
    }),
  ],
}