Skip to content

Commit

Permalink
fix(integrations): astro:build:done dir now matches SSR client outp…
Browse files Browse the repository at this point in the history
…ut (withastro#3008)

* `dir` now matches client output

* Updated integrations

* Changeset
  • Loading branch information
JuanM04 authored Apr 6, 2022
1 parent bb9f9db commit db095ad
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/core/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
});
Expand Down
7 changes: 6 additions & 1 deletion src/integrations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
});
}
Expand Down

0 comments on commit db095ad

Please sign in to comment.