diff --git a/.changeset/swift-lamps-doubt.md b/.changeset/swift-lamps-doubt.md new file mode 100644 index 0000000000..2ee2f6fb35 --- /dev/null +++ b/.changeset/swift-lamps-doubt.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Add route information when warning of `getStaticPaths()` ignored diff --git a/packages/astro/src/core/routing/validation.ts b/packages/astro/src/core/routing/validation.ts index 047a5b8923..911a97a9e4 100644 --- a/packages/astro/src/core/routing/validation.ts +++ b/packages/astro/src/core/routing/validation.ts @@ -1,3 +1,4 @@ +import { bold } from 'kleur/colors'; import type { ComponentInstance, GetStaticPathsResult, RouteData } from '../../@types/astro'; import { AstroError, AstroErrorData } from '../errors/index.js'; import type { LogOptions } from '../logger/core'; @@ -32,7 +33,11 @@ export function validateDynamicRouteModule( } ) { if (ssr && mod.getStaticPaths && !mod.prerender) { - warn(logging, 'getStaticPaths', 'getStaticPaths() is ignored when "output: server" is set.'); + warn( + logging, + 'getStaticPaths', + `getStaticPaths() in ${bold(route.component)} is ignored when "output: server" is set.` + ); } if ((!ssr || mod.prerender) && !mod.getStaticPaths) { throw new AstroError({