@@ -24,7 +24,7 @@ require('../config/env');
24
24
25
25
const fs = require ( 'fs' ) ;
26
26
const chalk = require ( 'chalk' ) ;
27
- const detect = require ( 'detect-port' ) ;
27
+ const detect = require ( '@timer/ detect-port' ) ;
28
28
const WebpackDevServer = require ( 'webpack-dev-server' ) ;
29
29
const clearConsole = require ( 'react-dev-utils/clearConsole' ) ;
30
30
const checkRequiredFiles = require ( 'react-dev-utils/checkRequiredFiles' ) ;
@@ -48,10 +48,10 @@ if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {
48
48
49
49
// Tools like Cloud9 rely on this.
50
50
const DEFAULT_PORT = parseInt ( process . env . PORT , 10 ) || 3000 ;
51
+ const HOST = process . env . HOST || '0.0.0.0' ;
51
52
52
53
function run ( port ) {
53
54
const protocol = process . env . HTTPS === 'true' ? 'https' : 'http' ;
54
- const host = process . env . HOST || '0.0.0.0' ;
55
55
56
56
// Create a webpack compiler that is configured with custom messages.
57
57
const compiler = createWebpackCompiler (
@@ -63,7 +63,7 @@ function run(port) {
63
63
console . log ( ) ;
64
64
console . log ( 'The app is running at:' ) ;
65
65
console . log ( ) ;
66
- console . log ( ` ${ chalk . cyan ( `${ protocol } ://${ host } :${ port } /` ) } ` ) ;
66
+ console . log ( ` ${ chalk . cyan ( `${ protocol } ://${ HOST } :${ port } /` ) } ` ) ;
67
67
console . log ( ) ;
68
68
console . log ( 'Note that the development build is not optimized.' ) ;
69
69
console . log (
@@ -80,7 +80,7 @@ function run(port) {
80
80
addWebpackMiddleware ( devServer )
81
81
. then ( ( ) => {
82
82
// Launch WebpackDevServer.
83
- devServer . listen ( port , host , err => {
83
+ devServer . listen ( port , HOST , err => {
84
84
if ( err ) {
85
85
return console . log ( err ) ;
86
86
}
@@ -91,7 +91,7 @@ function run(port) {
91
91
console . log ( chalk . cyan ( 'Starting the development server...' ) ) ;
92
92
console . log ( ) ;
93
93
94
- openBrowser ( `${ protocol } ://${ host } :${ port } /` ) ;
94
+ openBrowser ( `${ protocol } ://${ HOST } :${ port } /` ) ;
95
95
} ) ;
96
96
} )
97
97
. catch ( e => {
@@ -105,7 +105,7 @@ function run(port) {
105
105
106
106
// We attempt to use the default port but if it is busy, we offer the user to
107
107
// run on a different port. `detect()` Promise resolves to the next free port.
108
- detect ( DEFAULT_PORT ) . then ( port => {
108
+ detect ( DEFAULT_PORT , HOST ) . then ( port => {
109
109
if ( port === DEFAULT_PORT ) {
110
110
run ( port ) ;
111
111
return ;
0 commit comments