Skip to content

Commit df5211e

Browse files
authored
Merge pull request #42 from laravel/use-hmr-host-when-set
Use HMR host when set
2 parents a7da3be + 87c2d48 commit df5211e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,10 @@ 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 configHmrHost = typeof server.config.server.hmr === 'object' ? server.config.server.hmr.host : null
123124
const configHost = typeof server.config.server.host === 'string' ? server.config.server.host : null
124125
const serverAddress = address.family === 'IPv6' ? `[${address.address}]` : address.address
125-
const host = configHost ?? serverAddress
126+
const host = configHmrHost ?? configHost ?? serverAddress
126127
viteDevServerUrl = `${protocol}://${host}:${address.port}`
127128
fs.writeFileSync(hotFile, viteDevServerUrl)
128129

0 commit comments

Comments
 (0)