From fd0e9ce605ffb3ce32bd9dbde4037ee90afd093c Mon Sep 17 00:00:00 2001 From: Drew Powers <1369770+drwpow@users.noreply.github.com> Date: Mon, 8 Nov 2021 14:43:10 -0700 Subject: [PATCH] fix: Improve Vite config merging (#1768) #1755 --- packages/astro/src/core/build/index.ts | 16 +++++++++------- packages/astro/src/core/dev/index.ts | 16 +++++++++------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/packages/astro/src/core/build/index.ts b/packages/astro/src/core/build/index.ts index 674748bb0..d00c8c8bf 100644 --- a/packages/astro/src/core/build/index.ts +++ b/packages/astro/src/core/build/index.ts @@ -55,14 +55,16 @@ class AstroBuilder { const { logging, origin } = this; const timer: Record = { viteStart: performance.now() }; const viteConfig = await createVite( - { - mode: this.mode, - server: { - hmr: { overlay: false }, - middlewareMode: 'ssr', + vite.mergeConfig( + { + mode: this.mode, + server: { + hmr: { overlay: false }, + middlewareMode: 'ssr', + }, }, - ...(this.config.vite || {}), - }, + this.config.vite || {} + ), { astroConfig: this.config, logging } ); const viteServer = await vite.createServer(viteConfig); diff --git a/packages/astro/src/core/dev/index.ts b/packages/astro/src/core/dev/index.ts index f0e82df14..572ab72c3 100644 --- a/packages/astro/src/core/dev/index.ts +++ b/packages/astro/src/core/dev/index.ts @@ -222,14 +222,16 @@ export class AstroDevServer { private async createViteServer() { const viteConfig = await createVite( - { - mode: 'development', - server: { - middlewareMode: 'ssr', - host: this.hostname, + vite.mergeConfig( + { + mode: 'development', + server: { + middlewareMode: 'ssr', + host: this.hostname, + }, }, - ...(this.config.vite || {}), - }, + this.config.vite || {} + ), { astroConfig: this.config, logging: this.logging, devServer: this } ); const viteServer = await vite.createServer(viteConfig);