提交 2d510d64 编写于 作者: S Scott Raymond 提交者: Tim Neutkens

Add hostname argument to next-dev (#2500) (#2506)

上级 fc259cf9
......@@ -12,12 +12,12 @@ process.env.NODE_ENV = process.env.NODE_ENV || 'development'
const argv = parseArgs(process.argv.slice(2), {
alias: {
h: 'help',
H: 'hostname',
p: 'port'
},
boolean: ['h'],
default: {
p: 3000
}
string: ['H'],
default: { p: 3000 }
})
if (argv.help) {
......@@ -35,6 +35,7 @@ if (argv.help) {
Options
--port, -p A port number on which to start the application
--hostname, -H Hostname on which to start the application
--help, -h Displays this message
`)
process.exit(0)
......@@ -56,10 +57,10 @@ if (!existsSync(join(dir, 'pages'))) {
}
const srv = new Server({ dir, dev: true })
srv.start(argv.port)
srv.start(argv.port, argv.hostname)
.then(async () => {
if (!process.env.NOW) {
console.log(`> Ready on http://localhost:${argv.port}`)
console.log(`> Ready on http://${argv.hostname ? argv.hostname : 'localhost'}:${argv.port}`)
}
})
.catch((err) => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册