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',