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

fix(nuxi, vite): ipv6 support for nuxi dev #7560

Merged
merged 3 commits into from Sep 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/nuxi/package.json
Expand Up @@ -36,7 +36,7 @@
"flat": "^5.0.2",
"giget": "^0.1.6",
"jiti": "^1.15.0",
"listhen": "^0.3.0",
"listhen": "^0.3.1",
"mlly": "^0.5.14",
"mri": "^1.2.0",
"pathe": "^0.3.7",
Expand Down
1 change: 1 addition & 0 deletions packages/nuxi/src/commands/dev.ts
Expand Up @@ -91,6 +91,7 @@ export default defineNuxtCommand({

await currentNuxt.hooks.callHook('listen', listener.server, listener)
const address = listener.server.address() as AddressInfo
currentNuxt.options.server.url = listener.url
currentNuxt.options.server.port = address.port
currentNuxt.options.server.host = address.address
currentNuxt.options.server.https = Boolean(args.https)
Expand Down
7 changes: 6 additions & 1 deletion packages/schema/src/config/server.ts
Expand Up @@ -39,5 +39,10 @@ export default <SchemaDefinition>{
* time spent on server-side rendering.
*/
/** @deprecated This option is ignored with Bridge and Nuxt 3 */
timing: (val: any) => val ? ({ total: true, ...val }) : false
timing: (val: any) => val ? ({ total: true, ...val }) : false,

/**
* Listening dev server url
*/
url: 'http://localhost:3000',
}
6 changes: 1 addition & 5 deletions packages/vite/src/vite-node.ts
Expand Up @@ -123,13 +123,9 @@ function createViteNodeMiddleware (ctx: ViteBuildContext, invalidates: Set<strin
}

export async function initViteNodeServer (ctx: ViteBuildContext) {
const host = ctx.nuxt.options.server.host || 'localhost'
const port = ctx.nuxt.options.server.port || '3000'
const protocol = ctx.nuxt.options.server.https ? 'https' : 'http'

// Serialize and pass vite-node runtime options
const viteNodeServerOptions = {
baseURL: `${protocol}://${host}:${port}/__nuxt_vite_node__`,
baseURL: `${ctx.nuxt.options.server.url}__nuxt_vite_node__`,
root: ctx.nuxt.options.srcDir,
entryPath: ctx.entry,
base: ctx.ssrServer!.config.base || '/_nuxt/'
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Expand Up @@ -9088,9 +9088,9 @@ __metadata:
languageName: node
linkType: hard

"listhen@npm:^0.3.0":
version: 0.3.0
resolution: "listhen@npm:0.3.0"
"listhen@npm:^0.3.1":
version: 0.3.1
resolution: "listhen@npm:0.3.1"
dependencies:
clipboardy: ^3.0.0
colorette: ^2.0.19
Expand All @@ -9100,7 +9100,7 @@ __metadata:
ip-regex: ^5.0.0
node-forge: ^1.3.1
ufo: ^0.8.5
checksum: 4b34a6ef14e2bd91325275df567df6592233419f2bfc34195b565e29fa642ad74ffbeab3bcf524c314f4128ce0129d0d443b460c8bc0d1090f888c08cdf970ce
checksum: 2a260fd6edbf8459be04e6f762617b535a3bbbf92d79e219145c3a301b141b93987a2cfee42081a929e9d92b3628dc2cec93cb1fea4ec0539914c5dc3331fca2
languageName: node
linkType: hard

Expand Down Expand Up @@ -10454,7 +10454,7 @@ __metadata:
fsevents: ~2.3.2
giget: ^0.1.6
jiti: ^1.15.0
listhen: ^0.3.0
listhen: ^0.3.1
mlly: ^0.5.14
mri: ^1.2.0
pathe: ^0.3.7
Expand Down