Add route information for getStaticPaths warning (#7126)
This commit is contained in:
parent
31cbf4357e
commit
530fb9ebee
2 changed files with 11 additions and 1 deletions
5
.changeset/swift-lamps-doubt.md
Normal file
5
.changeset/swift-lamps-doubt.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'astro': patch
|
||||
---
|
||||
|
||||
Add route information when warning of `getStaticPaths()` ignored
|
|
@ -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({
|
||||
|
|
Loading…
Reference in a new issue