diff --git a/.changeset/grumpy-chefs-judge.md b/.changeset/grumpy-chefs-judge.md new file mode 100644 index 000000000..a3a7d22f2 --- /dev/null +++ b/.changeset/grumpy-chefs-judge.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fix issue where hostname was not passed to dev server diff --git a/packages/astro/src/core/dev/index.ts b/packages/astro/src/core/dev/index.ts index ae1b57997..c8da25490 100644 --- a/packages/astro/src/core/dev/index.ts +++ b/packages/astro/src/core/dev/index.ts @@ -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);