Skip to content
This repository was archived by the owner on Apr 6, 2023. It is now read-only.

Commit b4bea51

Browse files
authored
fix(nuxi): update server.port and server.host with listener info (#6595)
1 parent 7432020 commit b4bea51

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

packages/nuxi/src/commands/dev.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { AddressInfo } from 'node:net'
12
import { resolve, relative, normalize } from 'pathe'
23
import chokidar from 'chokidar'
34
import { debounce } from 'perfect-debounce'
@@ -75,7 +76,12 @@ export default defineNuxtCommand({
7576
}
7677

7778
await currentNuxt.ready()
79+
7880
await currentNuxt.hooks.callHook('listen', listener.server, listener)
81+
const address = listener.server.address() as AddressInfo
82+
currentNuxt.options.server.port = address.port
83+
currentNuxt.options.server.host = address.address
84+
7985
await Promise.all([
8086
writeTypes(currentNuxt).catch(console.error),
8187
buildNuxt(currentNuxt)

packages/vite/src/vite-node.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ export async function initViteNodeServer (ctx: ViteBuildContext) {
135135
entryPath = resolve(ctx.nuxt.options.appDir, 'entry.async')
136136
}
137137

138-
// TODO: Update me
139138
const host = ctx.nuxt.options.server.host || 'localhost'
140139
const port = ctx.nuxt.options.server.port || '3000'
141140
const protocol = ctx.nuxt.options.server.https ? 'https' : 'http'

0 commit comments

Comments
 (0)