add back dev server host support (#2531)

This commit is contained in:
Fred K. Schott 2022-02-03 13:40:40 -08:00 committed by GitHub
parent 069e497a74
commit ef1d81effd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Fix issue where hostname was not passed to dev server

View file

@ -24,7 +24,15 @@ export default async function dev(config: AstroConfig, options: DevOptions = { l
exclude: 'window document',
});
// start the server
const viteUserConfig = vite.mergeConfig({ mode: 'development' }, config.vite || {});
const viteUserConfig = vite.mergeConfig(
{
mode: 'development',
server: {
host: config.devOptions.hostname,
},
},
config.vite || {}
);
const viteConfig = await createVite(viteUserConfig, { astroConfig: config, logging: options.logging });
const viteServer = await vite.createServer(viteConfig);
await viteServer.listen(config.devOptions.port);