diff options
author | 2023-05-19 18:13:46 +0800 | |
---|---|---|
committer | 2023-05-19 18:13:46 +0800 | |
commit | 530fb9ebee77646921ec29d45d9b66484bdfb521 (patch) | |
tree | c156930dcf23205a7818c00e09d5b17bb3b45d35 | |
parent | 31cbf4357e866abab62bb4ccf949f5a59aec06ac (diff) | |
download | astro-530fb9ebee77646921ec29d45d9b66484bdfb521.tar.gz astro-530fb9ebee77646921ec29d45d9b66484bdfb521.tar.zst astro-530fb9ebee77646921ec29d45d9b66484bdfb521.zip |
Add route information for getStaticPaths warning (#7126)
-rw-r--r-- | .changeset/swift-lamps-doubt.md | 5 | ||||
-rw-r--r-- | packages/astro/src/core/routing/validation.ts | 7 |
2 files changed, 11 insertions, 1 deletions
diff --git a/.changeset/swift-lamps-doubt.md b/.changeset/swift-lamps-doubt.md new file mode 100644 index 000000000..2ee2f6fb3 --- /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 047a5b892..911a97a9e 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({ |