From ef1d81effd4e0c420c6eb2e5e500cfaac3106ea8 Mon Sep 17 00:00:00 2001 From: "Fred K. Schott" Date: Thu, 3 Feb 2022 13:40:40 -0800 Subject: [PATCH] add back dev server host support (#2531) --- .changeset/grumpy-chefs-judge.md | 5 +++++ packages/astro/src/core/dev/index.ts | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 .changeset/grumpy-chefs-judge.md 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);