File tree 2 files changed +12
-3
lines changed
2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -73,7 +73,9 @@ module.exports = function prepareProxy(proxy) {
73
73
// `proxy` lets you specify alternate servers for specific requests.
74
74
// It can either be a string or an object conforming to the Webpack dev server proxy configuration
75
75
// https://webpack.github.io/docs/webpack-dev-server.html
76
- if ( ! proxy ) return undefined ;
76
+ if ( ! proxy ) {
77
+ return undefined ;
78
+ }
77
79
if ( typeof proxy !== 'object' && typeof proxy !== 'string' ) {
78
80
console . log (
79
81
chalk . red (
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ const config = require('../config/webpack.config.dev');
36
36
const devServerConfig = require ( '../config/webpackDevServer.config' ) ;
37
37
const createWebpackCompiler = require ( './utils/createWebpackCompiler' ) ;
38
38
const prepareProxy = require ( 'react-dev-utils/prepareProxy' ) ;
39
+ const url = require ( 'url' ) ;
39
40
40
41
const useYarn = fs . existsSync ( paths . yarnLockFile ) ;
41
42
const cli = useYarn ? 'yarn' : 'npm' ;
@@ -52,6 +53,12 @@ const HOST = process.env.HOST || '0.0.0.0';
52
53
53
54
function run ( port ) {
54
55
const protocol = process . env . HTTPS === 'true' ? 'https' : 'http' ;
56
+ const formattedUrl = url . format ( {
57
+ protocol,
58
+ hostname : HOST ,
59
+ port,
60
+ pathname : '/' ,
61
+ } ) ;
55
62
56
63
// Create a webpack compiler that is configured with custom messages.
57
64
const compiler = createWebpackCompiler (
@@ -63,7 +70,7 @@ function run(port) {
63
70
console . log ( ) ;
64
71
console . log ( 'The app is running at:' ) ;
65
72
console . log ( ) ;
66
- console . log ( ` ${ chalk . cyan ( ` ${ protocol } :// ${ HOST } : ${ port } /` ) } ` ) ;
73
+ console . log ( ` ${ chalk . cyan ( formattedUrl ) } ` ) ;
67
74
console . log ( ) ;
68
75
console . log ( 'Note that the development build is not optimized.' ) ;
69
76
console . log (
@@ -93,7 +100,7 @@ function run(port) {
93
100
console . log ( chalk . cyan ( 'Starting the development server...' ) ) ;
94
101
console . log ( ) ;
95
102
96
- openBrowser ( ` ${ protocol } :// ${ HOST } : ${ port } /` ) ;
103
+ openBrowser ( formattedUrl ) ;
97
104
} ) ;
98
105
}
99
106
You can’t perform that action at this time.
0 commit comments