diff --git a/src/cli.ts b/src/cli.ts index 6938df7..a4f4f9c 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -97,6 +97,10 @@ cli process.env.NO_SANDBOX = '1' } + if (options['--']) { + process.env.ELECTRON_CLI_ARGS = JSON.stringify(options['--']); + } + if (options.entry) { process.env.ELECTRON_ENTRY = options.entry } @@ -151,6 +155,10 @@ cli process.env.ELECTRON_ENTRY = options.entry } + if (options['--']) { + process.env.ELECTRON_CLI_ARGS = JSON.stringify(options['--']); + } + try { await preview(inlineConfig, { skipBuild: options.skipBuild }) } catch (e) { diff --git a/src/electron.ts b/src/electron.ts index c5f5a2c..436bd6e 100644 --- a/src/electron.ts +++ b/src/electron.ts @@ -125,7 +125,7 @@ export function startElectron(root: string | undefined): ChildProcess { const isDev = process.env.NODE_ENV_ELECTRON_VITE === 'development' - const args: string[] = [] + const args: string[] = process.env.ELECTRON_CLI_ARGS ? JSON.parse(process.env.ELECTRON_CLI_ARGS) : [] if (!!process.env.REMOTE_DEBUGGING_PORT && isDev) { args.push(`--remote-debugging-port=${process.env.REMOTE_DEBUGGING_PORT}`)