feat: support for passing arguments to electron
in dev
and preview
commands (#339)
This commit is contained in:
parent
a8f5182d25
commit
9b04362e12
|
@ -97,6 +97,10 @@ cli
|
||||||
process.env.NO_SANDBOX = '1'
|
process.env.NO_SANDBOX = '1'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (options['--']) {
|
||||||
|
process.env.ELECTRON_CLI_ARGS = JSON.stringify(options['--']);
|
||||||
|
}
|
||||||
|
|
||||||
if (options.entry) {
|
if (options.entry) {
|
||||||
process.env.ELECTRON_ENTRY = options.entry
|
process.env.ELECTRON_ENTRY = options.entry
|
||||||
}
|
}
|
||||||
|
@ -151,6 +155,10 @@ cli
|
||||||
process.env.ELECTRON_ENTRY = options.entry
|
process.env.ELECTRON_ENTRY = options.entry
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (options['--']) {
|
||||||
|
process.env.ELECTRON_CLI_ARGS = JSON.stringify(options['--']);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await preview(inlineConfig, { skipBuild: options.skipBuild })
|
await preview(inlineConfig, { skipBuild: options.skipBuild })
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -125,7 +125,7 @@ export function startElectron(root: string | undefined): ChildProcess {
|
||||||
|
|
||||||
const isDev = process.env.NODE_ENV_ELECTRON_VITE === 'development'
|
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) {
|
if (!!process.env.REMOTE_DEBUGGING_PORT && isDev) {
|
||||||
args.push(`--remote-debugging-port=${process.env.REMOTE_DEBUGGING_PORT}`)
|
args.push(`--remote-debugging-port=${process.env.REMOTE_DEBUGGING_PORT}`)
|
||||||
|
|
Loading…
Reference in a new issue