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

* fix(nuxi): ipv6 support for `nuxi dev`

* fix vite: use listener url directly

* add url to schema
This commit is contained in:
pooya parsa 2022-09-15 18:10:36 +02:00 committed by GitHub
parent 1f3d9a1e84
commit 43b9bcaeaf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 12 deletions

View File

@ -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",

View File

@ -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)

View File

@ -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',
}

View File

@ -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/'

View File

@ -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
@ -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
@ -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