@@ -9,6 +9,7 @@ import chalk from 'chalk'
9
9
import { dirname } from 'pathe'
10
10
import { build } from 'nitropack'
11
11
import { defu } from 'defu'
12
+ import type { ConsolaInstance } from 'consola'
12
13
import { extractSitemapMetaFromHtml } from './util/extractSitemapMetaFromHtml'
13
14
import type { ModuleRuntimeConfig , SitemapUrl } from './runtime/types'
14
15
import { splitForLocales } from './runtime/utils-pure'
@@ -43,9 +44,14 @@ export function isNuxtGenerate(nuxt: Nuxt = useNuxt()) {
43
44
] . includes ( resolveNitroPreset ( ) )
44
45
}
45
46
46
- export function setupPrerenderHandler ( options : ModuleRuntimeConfig , nuxt : Nuxt = useNuxt ( ) ) {
47
+ export function setupPrerenderHandler ( _options : { runtimeConfig : ModuleRuntimeConfig , logger : ConsolaInstance } , nuxt : Nuxt = useNuxt ( ) ) {
48
+ const { runtimeConfig : options , logger } = _options
47
49
const prerenderedRoutes = ( nuxt . options . nitro . prerender ?. routes || [ ] ) as string [ ]
48
- const prerenderSitemap = isNuxtGenerate ( ) || includesSitemapRoot ( options . sitemapName , prerenderedRoutes )
50
+ let prerenderSitemap = isNuxtGenerate ( ) || includesSitemapRoot ( options . sitemapName , prerenderedRoutes )
51
+ if ( resolveNitroPreset ( ) === 'vercel-edge' ) {
52
+ logger . warn ( 'Runtime sitemaps are not supported on Vercel Edge, falling back to prerendering sitemaps.' )
53
+ prerenderSitemap = true
54
+ }
49
55
// need to filter it out of the config as we render it after all other routes
50
56
if ( nuxt . options . nitro . prerender ?. routes )
51
57
nuxt . options . nitro . prerender . routes = nuxt . options . nitro . prerender . routes . filter ( r => r && ! includesSitemapRoot ( options . sitemapName , [ r ] ) )
0 commit comments