Skip to content

Commit 84a3f27

Browse files
committed
next analyze: Make ipv6 server links valid and normalize localhost
1 parent 7638615 commit 84a3f27

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

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

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,11 @@ export default async function analyze({
7777
await turbopackAnalyze(analyzeContext)
7878

7979
const durationString = durationToString(analyzeDuration)
80-
Log.event(
81-
`Analyze data created successfully in ${durationString}. To explore it, run \`next experimental-analyze --serve\`.`
82-
)
80+
let logMessage = `Analyze completed in ${durationString}.`
81+
if (!serve) {
82+
logMessage += ` To explore the analyze results, run \`next experimental-analyze --serve\`.`
83+
}
84+
Log.event(logMessage)
8385

8486
await shutdownPromise
8587

@@ -238,8 +240,15 @@ function startServer(dir: string, port: number): Promise<void> {
238240
let addressString
239241
if (typeof address === 'string') {
240242
addressString = address
243+
} else if (
244+
address.family === 'IPv6' &&
245+
(address.address === '::' || address.address === '::1')
246+
) {
247+
addressString = `localhost:${address.port}`
248+
} else if (address.family === 'IPv6') {
249+
addressString = `[${address.address}]:${address.port}`
241250
} else {
242-
addressString = `${address.address === '::' ? 'localhost' : address.address}:${address.port}`
251+
addressString = `${address.address}:${address.port}`
243252
}
244253

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

0 commit comments

Comments
 (0)