File tree Expand file tree Collapse file tree 1 file changed +16
-9
lines changed
packages/vue-component/plugin Expand file tree Collapse file tree 1 file changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -35,21 +35,28 @@ if(Meteor.isDevelopment) {
3535 }
3636 } ) ;
3737
38- function getMeteorPort ( ) {
38+ function getMeteorBinding ( ) {
39+ const reg = / (?: - - p o r t | - p ) (?: = | \s ) (?: ( [ 0 - 9 . ] + ) : ) ? ( \d + ) / gi;
3940 const argv = this . process . argv ;
40- let index = argv . indexOf ( '--port' ) ;
41- if ( index === - 1 ) {
42- index = argv . indexOf ( '-p' ) ;
43- }
44- if ( index !== - 1 && argv . length > index ) {
45- return parseInt ( argv [ index + 1 ] ) + 3 ;
41+ const result = reg . exec ( argv ) ;
42+ if ( result && result . length >= 2 ) {
43+ let interface = result [ 1 ] ;
44+ let port = parseInt ( result [ 2 ] ) ;
45+ return { interface, port} ;
4646 }
47+ return { }
4748 }
4849
49- PORT = parseInt ( process . env . HMR_PORT ) || parseInt ( process . env . VUE_DEV_SERVER_PORT ) || getMeteorPort ( ) || 3003 ;
50+ PORT = parseInt ( process . env . HMR_PORT ) || parseInt ( process . env . VUE_DEV_SERVER_PORT ) || getMeteorBinding ( ) . port + 3 || 3003 ;
51+ INTERFACE = getMeteorBinding ( ) . interface
5052
5153 try {
52- server . listen ( PORT ) ;
54+ if ( INTERFACE ) {
55+ server . listen ( PORT , INTERFACE ) ;
56+ }
57+ else {
58+ server . listen ( PORT )
59+ }
5360 if ( process . stdout . clearLine ) {
5461 process . stdout . clearLine ( ) ;
5562 }
You can’t perform that action at this time.
0 commit comments