File tree 1 file changed +8
-2
lines changed
1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -73,7 +73,13 @@ module.exports = async function dev (sourceDir, cliOptions = {}) {
73
73
}
74
74
75
75
const compiler = webpack ( config )
76
- const host = cliOptions . host || options . siteConfig . host || '0.0.0.0'
76
+ // webpack-serve hot updates doesn't work properly over 0.0.0.0 on Windows,
77
+ // but localhost does not allow visiting over network :/
78
+ const defaultHost = process . platform === 'win32' ? 'localhost' : '0.0.0.0'
79
+ const host = cliOptions . host || options . siteConfig . host || defaultHost
80
+ const displayHost = host === defaultHost && process . platform !== 'win32'
81
+ ? 'localhost'
82
+ : host
77
83
portfinder . basePort = cliOptions . port || options . siteConfig . port || 8080
78
84
const port = await portfinder . getPortPromise ( )
79
85
@@ -83,7 +89,7 @@ module.exports = async function dev (sourceDir, cliOptions = {}) {
83
89
isFirst = false
84
90
console . log (
85
91
`\n VuePress dev server listening at ${
86
- chalk . cyan ( `http://${ host === '0.0.0.0' ? 'localhost' : host } :${ port } ${ options . publicPath } ` )
92
+ chalk . cyan ( `http://${ displayHost } :${ port } ${ options . publicPath } ` )
87
93
} \n`
88
94
)
89
95
} else {
You can’t perform that action at this time.
0 commit comments