mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-18 17:35:57 +00:00
fix(nuxi): support --inspect
in dev mode (#22205)
This commit is contained in:
parent
5b409f8579
commit
fb77cc04c7
@ -33,7 +33,10 @@ function startSubprocess () {
|
||||
start()
|
||||
|
||||
function start () {
|
||||
childProc = fork(fileURLToPath(cliEntry))
|
||||
const _argv: string[] = (process.env.__CLI_ARGV__ ? JSON.parse(process.env.__CLI_ARGV__) : process.argv).slice(2)
|
||||
const execArguments: string[] = getInspectArgs()
|
||||
|
||||
childProc = fork(fileURLToPath(cliEntry), [], { execArgv: execArguments })
|
||||
childProc.on('close', (code) => { if (code) { process.exit(code) } })
|
||||
childProc.on('message', (message) => {
|
||||
if ((message as { type: string })?.type === 'nuxt:restart') {
|
||||
@ -41,5 +44,15 @@ function startSubprocess () {
|
||||
startSubprocess()
|
||||
}
|
||||
})
|
||||
|
||||
function getInspectArgs (): string[] {
|
||||
const inspectArgv = _argv.find(argvItem => argvItem.includes('--inspect'))
|
||||
|
||||
if (!inspectArgv) {
|
||||
return []
|
||||
}
|
||||
|
||||
return [inspectArgv]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user