Skip to content

Commit 2e8d69c

Browse files
committed
feat($webpack): display host url at dev HMR log
1 parent 12c2beb commit 2e8d69c

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

lib/webpack/DevLogPlugin.js

+11-2
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,20 @@ module.exports = class DevLogPlugin {
1313

1414
const { displayHost, port, publicPath } = this.options
1515
const time = new Date().toTimeString().match(/^[\d:]+/)[0]
16+
const displayUrl = `http://${displayHost}:${port}${publicPath}`
1617

17-
logger.success(`\n${chalk.gray(`[${time}]`)} Build ${chalk.italic(stats.hash.slice(0, 6))} finished in ${stats.endTime - stats.startTime} ms!`)
18+
logger.success(
19+
`\n${chalk.gray(`[${time}]`)} Build ${chalk.italic(stats.hash.slice(0, 6))} ` +
20+
`finished in ${stats.endTime - stats.startTime} ms! ` +
21+
(
22+
isFirst
23+
? ''
24+
: `${chalk.gray(`(${displayUrl})`)}`
25+
)
26+
)
1827
if (isFirst) {
1928
isFirst = false
20-
console.log(`\n${chalk.gray('>')} VuePress dev server listening at ${chalk.cyan(`http://${displayHost}:${port}${publicPath}`)}`)
29+
console.log(`\n${chalk.gray('>')} VuePress dev server listening at ${chalk.cyan(displayUrl)}`)
2130
}
2231
})
2332
compiler.hooks.invalid.tap('vuepress-log', clearScreen)

0 commit comments

Comments
 (0)