feat: support for renderer debugging (#130)
This commit is contained in:
parent
f7f19f9649
commit
5ad0747f32
|
@ -59,7 +59,12 @@ cli
|
|||
.alias('serve')
|
||||
.alias('dev')
|
||||
.option('-w, --watch', `[boolean] rebuilds when main process or preload script modules have changed on disk`)
|
||||
.action(async (root: string, options: GlobalCLIOptions) => {
|
||||
.option('--remoteDebuggingPort <port>', `[string] port for remote debugging`)
|
||||
.action(async (root: string, options: { remoteDebuggingPort?: string } & GlobalCLIOptions) => {
|
||||
if (options.remoteDebuggingPort) {
|
||||
process.env.REMOTE_DEBUGGING_PORT = options.remoteDebuggingPort
|
||||
}
|
||||
|
||||
const { createServer } = await import('./server')
|
||||
const inlineConfig = createInlineConfig(root, options)
|
||||
|
||||
|
|
|
@ -114,7 +114,12 @@ export function startElectron(root: string | undefined, logger: Logger): ChildPr
|
|||
|
||||
const inspect = !!process.env.VSCODE_INSPECTOR_OPTIONS
|
||||
|
||||
const ps = spawn(electronPath, ['.'])
|
||||
const args: string[] = []
|
||||
if (!!process.env.REMOTE_DEBUGGING_PORT && process.env.NODE_ENV_ELECTRON_VITE === 'development') {
|
||||
args.push(`--remote-debugging-port=${process.env.REMOTE_DEBUGGING_PORT}`)
|
||||
}
|
||||
|
||||
const ps = spawn(electronPath, ['.'].concat(args))
|
||||
ps.stdout.on('data', chunk => {
|
||||
!inspect && chunk.toString().trim() && logger.info(chunk.toString())
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue