add host argument for packager.

Summary:
Now packager only listen to "::", which is IPv6 "Any address".
It failed to run in IPv4 Environment.

defaults to undefined or empty string will fix this.

And I think it's necessary to let user define host by cli argument.

It's also for security reason. When working on a public network, it's much safer to listen with localhost instead of ::, which may let everyone in same network be able to get your code from debugger-ui.

recommit for #1918, fixes #2441
Closes https://github.com/facebook/react-native/pull/5377

Reviewed By: svcscm

Differential Revision: D2842594

Pulled By: martinbigio

fb-gh-sync-id: 575944c5469dac80e99136a7903ea99f5339dba1
This commit is contained in:
DengYun 2016-01-19 16:47:01 -08:00 committed by facebook-github-bot-3
parent 4f37fe6f68
commit d4f6e447d2
2 changed files with 5 additions and 1 deletions

View File

@ -44,7 +44,7 @@ function runServer(args, config, readyCallback) {
const serverInstance = http.createServer(app).listen(
args.port,
'::',
args.host,
function() {
attachHMRServer({
httpServer: serverInstance,

View File

@ -30,6 +30,10 @@ function _server(argv, config, resolve, reject) {
command: 'port',
default: 8081,
type: 'string',
}, {
command: 'host',
default: '',
type: 'string',
}, {
command: 'root',
type: 'string',