From 97fbe938a9b07d52d61011da4bd5a8b5ad85a700 Mon Sep 17 00:00:00 2001 From: Emanuele Stoppa Date: Thu, 6 Jun 2024 14:22:57 +0100 Subject: [PATCH] fix: merge userConfig inside `getViteConfig` (#11194) --- .changeset/tidy-days-decide.md | 5 +++++ packages/astro/src/config/index.ts | 4 ++-- packages/astro/src/core/config/config.ts | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 .changeset/tidy-days-decide.md diff --git a/.changeset/tidy-days-decide.md b/.changeset/tidy-days-decide.md new file mode 100644 index 000000000000..53398e057fc9 --- /dev/null +++ b/.changeset/tidy-days-decide.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fixes an issue where the function `getViteConfig` wasn't returning the correct merged Astro configuration diff --git a/packages/astro/src/config/index.ts b/packages/astro/src/config/index.ts index 7950990ec7f7..aa078a94822f 100644 --- a/packages/astro/src/config/index.ts +++ b/packages/astro/src/config/index.ts @@ -34,7 +34,7 @@ export function getViteConfig(inlineConfig: UserConfig, inlineAstroConfig: Astro dest: nodeLogDestination, level: 'info', }); - const { astroConfig: config } = await resolveConfig(inlineAstroConfig, cmd); + const { astroConfig: config, userConfig } = await resolveConfig(inlineAstroConfig, cmd); let settings = await createSettings(config, inlineConfig.root); settings = await runHookConfigSetup({ settings, command: cmd, logger }); const viteConfig = await createVite( @@ -48,6 +48,6 @@ export function getViteConfig(inlineConfig: UserConfig, inlineAstroConfig: Astro { settings, logger, mode } ); await runHookConfigDone({ settings, logger }); - return mergeConfig(viteConfig, inlineConfig); + return mergeConfig(viteConfig, userConfig); }; } diff --git a/packages/astro/src/core/config/config.ts b/packages/astro/src/core/config/config.ts index d0cfd0e49702..9a700ab0ebbe 100644 --- a/packages/astro/src/core/config/config.ts +++ b/packages/astro/src/core/config/config.ts @@ -199,5 +199,5 @@ export async function resolveConfig( const mergedConfig = mergeConfig(userConfig, inlineUserConfig); const astroConfig = await validateConfig(mergedConfig, root, command); - return { userConfig, astroConfig }; + return { userConfig: mergedConfig, astroConfig }; }