@@ -80,19 +80,24 @@ function run(ionic, argv, rawCliArguments) {
8080 hasBuildCommand = results [ 2 ] ;
8181 hasServeCommand = results [ 3 ] ;
8282
83- if ( hasBuildCommand ) {
83+ if ( hasBuildCommand && ! ( isLiveReload && hasServeCommand ) ) {
8484 return npmScripts . runIonicScript ( 'build' ) ;
8585 }
8686 return Q ( ) ;
8787 } )
8888 . then ( function ( ) {
8989
90- if ( isLiveReload && hasServeCommand && false ) {
90+ // If we are running livereload and are using "ionic:serve" app-script
91+ // then configure devServer manually
92+ if ( isLiveReload && hasServeCommand ) {
9193
9294 // using app-scripts and livereload is requested
93- return ConfigXml . setConfigXml ( process . cwd ( ) , {
94- devServer : serveUtil . getUrl ( address , port )
95- } ) ;
95+ return npmScripts . runIonicScript ( 'serve' , [ '-p' , port , '--address' , address , '--nobrowser' ] )
96+ . then ( function ( ) {
97+ return ConfigXml . setConfigXml ( process . cwd ( ) , {
98+ devServer : serveUtil . getUrl ( address , port )
99+ } ) ;
100+ } ) ;
96101 } else if ( isLiveReload ) {
97102
98103 // not an app-scripts project but the user wants livereload
@@ -109,12 +114,6 @@ function run(ionic, argv, rawCliArguments) {
109114 var optionList = cordovaUtils . filterArgumentsForCordova ( cmdName , argv , rawArgs ) ;
110115 return cordovaUtils . execCordovaCommand ( optionList , isLiveReload , serveOptions ) ;
111116 } )
112- . then ( function ( ) {
113- if ( isLiveReload && hasServeCommand && false ) {
114- return npmScripts . runIonicScript ( 'serve' , [ '-p' , port , '--address' , address ] ) ;
115- }
116- return Q ( ) ;
117- } )
118117 . catch ( function ( ex ) {
119118 if ( ex instanceof Error ) {
120119 log . error ( ex ) ;
0 commit comments