Skip to content

Commit 7ea2c56

Browse files
committed
next analyze: Make ipv6 server links valid and normalize localhost
1 parent df181c9 commit 7ea2c56

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

packages/next/src/build/analyze/index.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,15 @@ function startServer(dir: string, port: number): Promise<void> {
238238
let addressString
239239
if (typeof address === 'string') {
240240
addressString = address
241+
} else if (
242+
address.family === 'IPv6' &&
243+
(address.address === '::' || address.address === '::1')
244+
) {
245+
addressString = `localhost:${address.port}`
246+
} else if (address.family === 'IPv6') {
247+
addressString = `[${address.address}]:${address.port}`
241248
} else {
242-
addressString = `${address.address === '::' ? 'localhost' : address.address}:${address.port}`
249+
addressString = `${address.address}:${address.port}`
243250
}
244251

245252
Log.info(`Bundle analyzer available at http://${addressString}`)

0 commit comments

Comments
 (0)