Skip to content

Commit

Permalink
fix(nuxi): fixes inspect debugger
Browse files Browse the repository at this point in the history
  • Loading branch information
Seboran committed Jul 18, 2023
1 parent 449a015 commit 748a291
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion packages/nuxi/src/cli-wrapper.ts
Expand Up @@ -4,6 +4,7 @@
import { fileURLToPath } from 'node:url'
import { fork } from 'node:child_process'
import type { ChildProcess } from 'node:child_process'
import mri from 'mri'

const cliEntry = new URL('../dist/cli-run.mjs', import.meta.url)

Expand Down Expand Up @@ -33,7 +34,18 @@ function startSubprocess () {
start()

function start () {
childProc = fork(fileURLToPath(cliEntry))
const _argv = (process.env.__CLI_ARGV__ ? JSON.parse(process.env.__CLI_ARGV__) : process.argv).slice(2)
const args = mri(_argv, {
boolean: [
'no-clear'
]
})
const execArguments: string[] = []

if (args.inspect) {
execArguments.push('--inspect=0.0.0.0')
}
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') {
Expand Down

0 comments on commit 748a291

Please sign in to comment.