Skip to content

Commit dae9842

Browse files
committed
Respect server.host variable in hot file
1 parent d4fc875 commit dae9842

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ export default function laravel(config: string|string[]|PluginConfig): LaravelPl
120120
const isAddressInfo = (x: string|AddressInfo|null|undefined): x is AddressInfo => typeof x === 'object'
121121
if (isAddressInfo(address)) {
122122
const protocol = server.config.server.https ? 'https' : 'http'
123-
const host = address.family === 'IPv6' ? `[${address.address}]` : address.address
123+
const configHost = typeof resolvedConfig.server.host === 'string' ? resolvedConfig.server.host : false
124+
const serverAddress = address.family === 'IPv6' ? `[${address.address}]` : address.address
125+
const host = configHost || serverAddress
124126
viteDevServerUrl = `${protocol}://${host}:${address.port}`
125127
fs.writeFileSync(hotFile, viteDevServerUrl)
126128

0 commit comments

Comments
 (0)