11const {
22 info
33} = require ( '@vue/cli-shared-utils' )
4+ const address = require ( 'address' )
45
56const defaults = {
67 mode : 'development' ,
78 host : '0.0.0.0' ,
89 port : 8080 ,
9- https : false
10+ https : false ,
11+ lanIp : address . ip ( )
1012}
1113
1214module . exports = ( api , options ) => {
13- const address = require ( 'address' )
1415 const portfinder = require ( 'portfinder' )
1516
1617 api . registerCommand ( 'cordova-serve' , {
@@ -20,7 +21,8 @@ module.exports = (api, options) => {
2021 '--open' : `open browser on server start` ,
2122 '--host' : `specify host (default: ${ defaults . host } )` ,
2223 '--port' : `specify port (default: ${ defaults . port } )` ,
23- '--https' : `use https (default: ${ defaults . https } )`
24+ '--https' : `use https (default: ${ defaults . https } )` ,
25+ '--lan-ip' : `IP of the machine running cordova-serve (default: ${ defaults . lanIp } )`
2426 }
2527 } , args => {
2628 const projectDevServerOptions = options . devServer || { }
@@ -31,7 +33,7 @@ module.exports = (api, options) => {
3133 host : args . host || process . env . HOST || projectDevServerOptions . host || defaults . host ,
3234 port,
3335 https : args . https || projectDevServerOptions . https || defaults . https ,
34- lanIp : address . ip ( )
36+ lanIp : args [ 'lan-ip' ] || defaults . lanIp
3537 }
3638 const wwwDirPath = api . resolve ( 'www' )
3739 info ( 'your www/index.html is overwrited.' )
0 commit comments