From 6753160b68f7f8283138e7689edde56d4f2bb249 Mon Sep 17 00:00:00 2001 From: JuanM04 Date: Wed, 6 Apr 2022 14:31:02 -0300 Subject: [PATCH] `dir` now matches client output --- packages/astro/src/core/build/index.ts | 1 + packages/astro/src/integrations/index.ts | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/astro/src/core/build/index.ts b/packages/astro/src/core/build/index.ts index ae6d9ff3eb22..98c8f1e8db23 100644 --- a/packages/astro/src/core/build/index.ts +++ b/packages/astro/src/core/build/index.ts @@ -174,6 +174,7 @@ class AstroBuilder { await viteServer.close(); await runHookBuildDone({ config: this.config, + buildConfig, pages: pageNames, routes: Object.values(allPages).map((pd) => pd.route), }); diff --git a/packages/astro/src/integrations/index.ts b/packages/astro/src/integrations/index.ts index 9e96b1a5a03b..452081e48578 100644 --- a/packages/astro/src/integrations/index.ts +++ b/packages/astro/src/integrations/index.ts @@ -4,6 +4,7 @@ import { AstroConfig, AstroRenderer, BuildConfig, RouteData } from '../@types/as import { mergeConfig } from '../core/config.js'; import ssgAdapter from '../adapter-ssg/index.js'; import type { ViteConfigWithSSR } from '../core/create-vite.js'; +import { isBuildingToSSR } from '../core/util.js'; export async function runHookConfigSetup({ config: _config, @@ -136,18 +137,22 @@ export async function runHookBuildSetup({ export async function runHookBuildDone({ config, + buildConfig, pages, routes, }: { config: AstroConfig; + buildConfig: BuildConfig; pages: string[]; routes: RouteData[]; }) { + const dir = isBuildingToSSR(config) ? buildConfig.client : config.outDir; + for (const integration of config.integrations) { if (integration.hooks['astro:build:done']) { await integration.hooks['astro:build:done']({ pages: pages.map((p) => ({ pathname: p })), - dir: config.outDir, + dir, routes, }); }