Commit 38a2bc7 1 parent 4b805c7 commit 38a2bc7 Copy full SHA for 38a2bc7
File tree 2 files changed +22
-5
lines changed
packages/@angular/cli/tasks
2 files changed +22
-5
lines changed Original file line number Diff line number Diff line change @@ -60,12 +60,13 @@ export default Task.extend({
60
60
61
61
let clientAddress = serverAddress ;
62
62
if ( serveTaskOptions . publicHost ) {
63
- const clientUrl = url . parse ( serveTaskOptions . publicHost ) ;
64
- // very basic sanity check
65
- if ( ! clientUrl . host ) {
66
- return Promise . reject ( new SilentError ( `'live-reload-client' must be a full URL.` ) ) ;
63
+ let publicHost = serveTaskOptions . publicHost ;
64
+ if ( ! / ^ \w + : \/ \/ / . test ( publicHost ) ) {
65
+ publicHost = `${ serveTaskOptions . ssl ? 'https' : 'http' } ://${ publicHost } ` ;
67
66
}
68
- clientAddress = clientUrl . href ;
67
+ const clientUrl = url . parse ( publicHost ) ;
68
+ serveTaskOptions . publicHost = clientUrl . host ;
69
+ clientAddress = url . format ( clientUrl ) ;
69
70
}
70
71
71
72
if ( serveTaskOptions . liveReload ) {
Original file line number Diff line number Diff line change @@ -39,5 +39,21 @@ export default function () {
39
39
throw new Error ( 'Response does not match expected value.' ) ;
40
40
}
41
41
} )
42
+ . then ( ( ) => killAllProcesses ( ) , ( err ) => { killAllProcesses ( ) ; throw err ; } )
43
+ . then ( ( ) => ngServe ( '--host=0.0.0.0' , `--public-host=${ localAddress } ` ) )
44
+ . then ( ( ) => request ( localAddress ) )
45
+ . then ( body => {
46
+ if ( ! body . match ( / < a p p - r o o t > < \/ a p p - r o o t > / ) ) {
47
+ throw new Error ( 'Response does not match expected value.' ) ;
48
+ }
49
+ } )
50
+ . then ( ( ) => killAllProcesses ( ) , ( err ) => { killAllProcesses ( ) ; throw err ; } )
51
+ . then ( ( ) => ngServe ( '--host=0.0.0.0' , `--public-host=${ firstLocalIp } ` ) )
52
+ . then ( ( ) => request ( localAddress ) )
53
+ . then ( body => {
54
+ if ( ! body . match ( / < a p p - r o o t > < \/ a p p - r o o t > / ) ) {
55
+ throw new Error ( 'Response does not match expected value.' ) ;
56
+ }
57
+ } )
42
58
. then ( ( ) => killAllProcesses ( ) , ( err ) => { killAllProcesses ( ) ; throw err ; } ) ;
43
59
}
You can’t perform that action at this time.
0 commit comments