File tree Expand file tree Collapse file tree 4 files changed +7
-2
lines changed Expand file tree Collapse file tree 4 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ export const preview = async () => {
15
15
const address = server . address ( ) ;
16
16
if ( address && typeof address !== "string" ) {
17
17
const open = ( await import ( "open" ) ) . default ;
18
- await open ( `http://localhost :${ address . port } ` ) ;
18
+ await open ( `http://${ address . address } :${ address . port } ` ) ;
19
19
}
20
20
21
21
startLocalChangeWatcher ( {
Original file line number Diff line number Diff line change @@ -224,6 +224,7 @@ describe("config", () => {
224
224
beforeEach ( ( ) => {
225
225
const userConfigData = {
226
226
includePrivate : true ,
227
+ host : "localhost" ,
227
228
port : 9999 ,
228
229
} ;
229
230
resetFiles ( ) ;
@@ -234,6 +235,7 @@ describe("config", () => {
234
235
const userConfig = await config . getUserConfig ( ) ;
235
236
expect ( userConfig ) . toStrictEqual ( {
236
237
includePrivate : true ,
238
+ host : "localhost" ,
237
239
port : 9999 ,
238
240
} ) ;
239
241
} ) ;
@@ -248,6 +250,7 @@ describe("config", () => {
248
250
const userConfig = await config . getUserConfig ( ) ;
249
251
expect ( userConfig ) . toStrictEqual ( {
250
252
includePrivate : false ,
253
+ host : "localhost" ,
251
254
port : 8888 ,
252
255
} ) ;
253
256
} ) ;
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ interface Options {
14
14
15
15
type UserConfig = {
16
16
includePrivate : boolean ;
17
+ host : string ;
17
18
port : number ;
18
19
} ;
19
20
@@ -107,6 +108,7 @@ class Config {
107
108
async getUserConfig ( ) {
108
109
const defaultConfig = {
109
110
includePrivate : false ,
111
+ host : "localhost" ,
110
112
port : 8888 ,
111
113
} as UserConfig ;
112
114
Original file line number Diff line number Diff line change @@ -32,8 +32,8 @@ export async function startServer() {
32
32
33
33
const server = createServer ( app ) ;
34
34
const userConfig = await config . getUserConfig ( ) ;
35
+ const host = userConfig . host ;
35
36
const port = userConfig . port ;
36
- const host = "localhost" ;
37
37
38
38
return new Promise < Server > ( ( resolve , reject ) => {
39
39
server
You can’t perform that action at this time.
0 commit comments