mirror of
https://github.com/nuxt/nuxt.git
synced 2025-03-09 03:03:18 +00:00
fix(nuxi): use file url to start nuxi (#19676)
This commit is contained in:
parent
2ebf5f4c44
commit
01ee5bd7c5
@ -5,14 +5,14 @@ import { fileURLToPath } from 'node:url'
|
||||
import { fork } from 'node:child_process'
|
||||
import type { ChildProcess } from 'node:child_process'
|
||||
|
||||
const cliEntry = fileURLToPath(new URL('../dist/cli-run.mjs', import.meta.url))
|
||||
const cliEntry = new URL('../dist/cli-run.mjs', import.meta.url)
|
||||
|
||||
// Only enable wrapper for nuxt dev command
|
||||
if (process.argv[2] === 'dev') {
|
||||
process.env.__CLI_ARGV__ = JSON.stringify(process.argv)
|
||||
startSubprocess()
|
||||
} else {
|
||||
import(cliEntry)
|
||||
import(cliEntry.href)
|
||||
}
|
||||
|
||||
function startSubprocess () {
|
||||
@ -33,7 +33,7 @@ function startSubprocess () {
|
||||
start()
|
||||
|
||||
function start () {
|
||||
childProc = fork(cliEntry)
|
||||
childProc = fork(fileURLToPath(cliEntry))
|
||||
childProc.on('close', (code) => { if (code) { process.exit(code) } })
|
||||
childProc.on('message', (message) => {
|
||||
if ((message as { type: string })?.type === 'nuxt:restart') {
|
||||
|
Loading…
Reference in New Issue
Block a user