From fd447aea06e759b4ea9bbca52bb1019a22c97d3f Mon Sep 17 00:00:00 2001 From: wangyi7099 Date: Wed, 18 Apr 2018 23:59:57 +0800 Subject: [PATCH] fix: use correct host in tip after the server has started (#130) --- lib/dev.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/dev.js b/lib/dev.js index 1b6d1b9297..e5dd3e7418 100644 --- a/lib/dev.js +++ b/lib/dev.js @@ -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() @@ -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 { @@ -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',