From 8da231855162af245f2b3664babb68dff0ba390f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Mat=C3=ADas=20Vega?= Date: Tue, 17 Dec 2024 14:40:36 +0100 Subject: [PATCH] fix: invoke vite.build with up to date configuration during astro:build:setup hook when target is "client" (#12763) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Alberto Matías --- .changeset/heavy-dots-sip.md | 5 +++++ packages/astro/src/core/build/static-build.ts | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/heavy-dots-sip.md diff --git a/.changeset/heavy-dots-sip.md b/.changeset/heavy-dots-sip.md new file mode 100644 index 000000000000..2e0c4c29b16c --- /dev/null +++ b/.changeset/heavy-dots-sip.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fixed changes to vite configuration made in the astro:build:setup integration hook having no effect when target is "client" diff --git a/packages/astro/src/core/build/static-build.ts b/packages/astro/src/core/build/static-build.ts index 0535aaa7ac65..935b4a2d5df8 100644 --- a/packages/astro/src/core/build/static-build.ts +++ b/packages/astro/src/core/build/static-build.ts @@ -283,7 +283,7 @@ async function clientBuild( base: settings.config.base, }; - await runHookBuildSetup({ + const updatedViteBuildConfig = await runHookBuildSetup({ config: settings.config, pages: internals.pagesByKeys, vite: viteBuildConfig, @@ -291,7 +291,7 @@ async function clientBuild( logger: opts.logger, }); - const buildResult = await vite.build(viteBuildConfig); + const buildResult = await vite.build(updatedViteBuildConfig); return buildResult; }