Skip to content

Commit fd447ae

Browse files
wangyi7099yyx990803
authored andcommitted
fix: use correct host in tip after the server has started (#130)
1 parent 196f23e commit fd447ae

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/dev.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ module.exports = async function dev (sourceDir, cliOptions = {}) {
7373
}
7474

7575
const compiler = webpack(config)
76+
const host = cliOptions.host || options.siteConfig.host || '0.0.0.0'
7677
portfinder.basePort = cliOptions.port || options.siteConfig.port || 8080
7778
const port = await portfinder.getPortPromise()
7879

@@ -82,7 +83,7 @@ module.exports = async function dev (sourceDir, cliOptions = {}) {
8283
isFirst = false
8384
console.log(
8485
`\n VuePress dev server listening at ${
85-
chalk.cyan(`http://localhost:${port}${options.publicPath}`)
86+
chalk.cyan(`http://${host}:${port}${options.publicPath}`)
8687
}\n`
8788
)
8889
} else {
@@ -97,7 +98,7 @@ module.exports = async function dev (sourceDir, cliOptions = {}) {
9798
// in cwd it would break the server
9899
content: [nonExistentDir],
99100
compiler,
100-
host: cliOptions.host || options.siteConfig.host || '0.0.0.0',
101+
host,
101102
dev: { logLevel: 'warn' },
102103
hot: { logLevel: 'error' },
103104
logLevel: 'error',

0 commit comments

Comments
 (0)