Skip to content

Commit

Permalink
fix: use correct host in tip after the server has started (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyi7099 authored and yyx990803 committed Apr 18, 2018
1 parent 196f23e commit fd447ae
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ module.exports = async function dev (sourceDir, cliOptions = {}) {
}

const compiler = webpack(config)
const host = cliOptions.host || options.siteConfig.host || '0.0.0.0'
portfinder.basePort = cliOptions.port || options.siteConfig.port || 8080
const port = await portfinder.getPortPromise()

Expand All @@ -82,7 +83,7 @@ module.exports = async function dev (sourceDir, cliOptions = {}) {
isFirst = false
console.log(
`\n VuePress dev server listening at ${
chalk.cyan(`http://localhost:${port}${options.publicPath}`)
chalk.cyan(`http://${host}:${port}${options.publicPath}`)
}\n`
)
} else {
Expand All @@ -97,7 +98,7 @@ module.exports = async function dev (sourceDir, cliOptions = {}) {
// in cwd it would break the server
content: [nonExistentDir],
compiler,
host: cliOptions.host || options.siteConfig.host || '0.0.0.0',
host,
dev: { logLevel: 'warn' },
hot: { logLevel: 'error' },
logLevel: 'error',
Expand Down

0 comments on commit fd447ae

Please sign in to comment.