mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
core: Show ip address if hostname is 0.0.0.0
This commit is contained in:
parent
6aaf839d54
commit
a3926d5266
@ -7,6 +7,7 @@ import fs from 'fs-extra'
|
||||
import consola from 'consola'
|
||||
import chalk from 'chalk'
|
||||
import esm from 'esm'
|
||||
import ip from 'ip'
|
||||
|
||||
import Options from '../common/options'
|
||||
import { sequence } from '../common/utils'
|
||||
@ -126,8 +127,10 @@ export default class Nuxt {
|
||||
}
|
||||
|
||||
({ address: host, port } = server.address())
|
||||
if (['127.0.0.1', '0.0.0.0'].includes(host)) {
|
||||
if (host === '127.0.0.1') {
|
||||
host = 'localhost'
|
||||
} else if (host === '0.0.0.0') {
|
||||
host = ip.address()
|
||||
}
|
||||
|
||||
const listenURL = chalk.underline.blue(`http://${host}:${port}`)
|
||||
|
@ -96,6 +96,7 @@
|
||||
"hash-sum": "^1.0.2",
|
||||
"html-minifier": "^3.5.19",
|
||||
"html-webpack-plugin": "^3.2.0",
|
||||
"ip": "^1.1.5",
|
||||
"launch-editor-middleware": "^2.2.1",
|
||||
"lodash": "^4.17.10",
|
||||
"lru-cache": "^4.1.3",
|
||||
|
@ -3702,6 +3702,10 @@ invert-kv@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6"
|
||||
|
||||
ip@^1.1.5:
|
||||
version "1.1.5"
|
||||
resolved "https://registry.yarnpkg.com/ip/-/ip-1.1.5.tgz#bdded70114290828c0a039e72ef25f5aaec4354a"
|
||||
|
||||
ipaddr.js@1.6.0:
|
||||
version "1.6.0"
|
||||
resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.6.0.tgz#e3fa357b773da619f26e95f049d055c72796f86b"
|
||||
|
Loading…
Reference in New Issue
Block a user