@@ -24,7 +24,7 @@ require('../config/env');
2424
2525const fs = require ( 'fs' ) ;
2626const chalk = require ( 'chalk' ) ;
27- const detect = require ( 'detect-port' ) ;
27+ const detect = require ( '@timer/ detect-port' ) ;
2828const WebpackDevServer = require ( 'webpack-dev-server' ) ;
2929const clearConsole = require ( 'react-dev-utils/clearConsole' ) ;
3030const checkRequiredFiles = require ( 'react-dev-utils/checkRequiredFiles' ) ;
@@ -48,10 +48,10 @@ if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {
4848
4949// Tools like Cloud9 rely on this.
5050const DEFAULT_PORT = parseInt ( process . env . PORT , 10 ) || 3000 ;
51+ const HOST = process . env . HOST || '0.0.0.0' ;
5152
5253function run ( port ) {
5354 const protocol = process . env . HTTPS === 'true' ? 'https' : 'http' ;
54- const host = process . env . HOST || '0.0.0.0' ;
5555
5656 // Create a webpack compiler that is configured with custom messages.
5757 const compiler = createWebpackCompiler (
@@ -63,7 +63,7 @@ function run(port) {
6363 console . log ( ) ;
6464 console . log ( 'The app is running at:' ) ;
6565 console . log ( ) ;
66- console . log ( ` ${ chalk . cyan ( `${ protocol } ://${ host } :${ port } /` ) } ` ) ;
66+ console . log ( ` ${ chalk . cyan ( `${ protocol } ://${ HOST } :${ port } /` ) } ` ) ;
6767 console . log ( ) ;
6868 console . log ( 'Note that the development build is not optimized.' ) ;
6969 console . log (
@@ -80,7 +80,7 @@ function run(port) {
8080 addWebpackMiddleware ( devServer )
8181 . then ( ( ) => {
8282 // Launch WebpackDevServer.
83- devServer . listen ( port , host , err => {
83+ devServer . listen ( port , HOST , err => {
8484 if ( err ) {
8585 return console . log ( err ) ;
8686 }
@@ -91,7 +91,7 @@ function run(port) {
9191 console . log ( chalk . cyan ( 'Starting the development server...' ) ) ;
9292 console . log ( ) ;
9393
94- openBrowser ( `${ protocol } ://${ host } :${ port } /` ) ;
94+ openBrowser ( `${ protocol } ://${ HOST } :${ port } /` ) ;
9595 } ) ;
9696 } )
9797 . catch ( e => {
@@ -105,7 +105,7 @@ function run(port) {
105105
106106// We attempt to use the default port but if it is busy, we offer the user to
107107// 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 => {
109109 if ( port === DEFAULT_PORT ) {
110110 run ( port ) ;
111111 return ;
0 commit comments