diff --git a/packages/astro/src/core/build/page-data.ts b/packages/astro/src/core/build/page-data.ts index ce9e60622e..15efea73b5 100644 --- a/packages/astro/src/core/build/page-data.ts +++ b/packages/astro/src/core/build/page-data.ts @@ -35,6 +35,8 @@ export async function collectPagesData( // and is then cached across all future SSR builds. In the past, we've had trouble // with parallelized builds without guaranteeing that this is called first. for (const route of manifest.routes) { + // Generate a unique key to identify each page in the build process. + const key = `${route.route}_${route.component}`; // static route: if (route.pathname) { const routeCollectionLogTimeout = setInterval(() => { @@ -47,8 +49,8 @@ export async function collectPagesData( clearInterval(routeCollectionLogTimeout); }, 10000); builtPaths.add(route.pathname); - - allPages[route.component] = { + allPages[key] = { + key: key, component: route.component, route, moduleSpecifier: '', @@ -72,8 +74,8 @@ export async function collectPagesData( continue; } // dynamic route: - - allPages[route.component] = { + allPages[key] = { + key: key, component: route.component, route, moduleSpecifier: '', diff --git a/packages/astro/src/core/build/types.ts b/packages/astro/src/core/build/types.ts index 9608ba04c5..b83e6e33af 100644 --- a/packages/astro/src/core/build/types.ts +++ b/packages/astro/src/core/build/types.ts @@ -21,6 +21,7 @@ export type StylesheetAsset = | { type: 'external'; src: string }; export interface PageBuildData { + key: string; component: ComponentPath; route: RouteData; moduleSpecifier: string; diff --git a/packages/create-astro/test/fixtures/not-empty/package.json b/packages/create-astro/test/fixtures/not-empty/package.json index 516149e6d0..d3f61d640c 100644 --- a/packages/create-astro/test/fixtures/not-empty/package.json +++ b/packages/create-astro/test/fixtures/not-empty/package.json @@ -6,4 +6,4 @@ "build": "astro build", "preview": "astro preview" } -} +} \ No newline at end of file