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 @@ -345,12 +345,21 @@ function resolveDevServerUrl(address: AddressInfo, config: ResolvedConfig): DevS
345345
346346 const configHmrHost = typeof config . server . hmr === 'object' ? config . server . hmr . host : null
347347 const configHost = typeof config . server . host === 'string' ? config . server . host : null
348- const serverAddress = address . family === 'IPv6' ? `[${ address . address } ]` : address . address
348+ const serverAddress = isIpv6 ( address ) ? `[${ address . address } ]` : address . address
349349 const host = configHmrHost ?? configHost ?? serverAddress
350350
351351 return `${ protocol } ://${ host } :${ address . port } `
352352}
353353
354+ function isIpv6 ( address : AddressInfo ) : boolean {
355+ return address . family === 'IPv6'
356+ // In node >=18.0 <18.4 this was an integer value. This was changed in a minor version.
357+ // See: https://github.com/laravel/vite-plugin/issues/103
358+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
359+ // @ts -ignore-next-line
360+ || address . family === 6 ;
361+ }
362+
354363/**
355364 * Add the Inertia helpers to the list of SSR dependencies that aren't externalized.
356365 *
You can’t perform that action at this time.
0 commit comments