File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -339,7 +339,7 @@ function resolveDevServerUrl(address: AddressInfo, config: ResolvedConfig): DevS
339339
340340 const configHmrHost = typeof config . server . hmr === 'object' ? config . server . hmr . host : null
341341 const configHost = typeof config . server . host === 'string' ? config . server . host : null
342- const serverAddress = address . family === 'IPv6' ? `[${ address . address } ]` : address . address
342+ const serverAddress = isIpv6 ( address ) ? `[${ address . address } ]` : address . address
343343 const host = configHmrHost ?? configHost ?? serverAddress
344344
345345 const configHmrClientPort = typeof config . server . hmr === 'object' ? config . server . hmr . clientPort : null
@@ -348,6 +348,15 @@ function resolveDevServerUrl(address: AddressInfo, config: ResolvedConfig): DevS
348348 return `${ protocol } ://${ host } :${ port } `
349349}
350350
351+ function isIpv6 ( address : AddressInfo ) : boolean {
352+ return address . family === 'IPv6'
353+ // In node >=18.0 <18.4 this was an integer value. This was changed in a minor version.
354+ // See: https://github.com/laravel/vite-plugin/issues/103
355+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
356+ // @ts -ignore-next-line
357+ || address . family === 6 ;
358+ }
359+
351360/**
352361 * Add the Inertia helpers to the list of SSR dependencies that aren't externalized.
353362 *
You can’t perform that action at this time.
0 commit comments