File tree 1 file changed +12
-2
lines changed
1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,6 @@ import type { Nuxt } from '@nuxt/schema'
6
6
import type { Nitro , PrerenderRoute } from 'nitropack'
7
7
import chalk from 'chalk'
8
8
import { dirname } from 'pathe'
9
- import { build } from 'nitropack'
10
9
import { defu } from 'defu'
11
10
import type { ConsolaInstance } from 'consola'
12
11
import { extractSitemapMetaFromHtml } from './util/extractSitemapMetaFromHtml'
@@ -90,8 +89,19 @@ export function setupPrerenderHandler(_options: { runtimeConfig: ModuleRuntimeCo
90
89
} ) , route . _sitemap ) as SitemapUrl
91
90
} )
92
91
nitro . hooks . hook ( 'prerender:done' , async ( ) => {
92
+ const isNuxt4 = nuxt . options . _majorVersion === 4
93
+ let nitroModule
94
+ if ( isNuxt4 ) {
95
+ nitroModule = await import ( String ( 'nitro' ) )
96
+ }
97
+ else {
98
+ nitroModule = await import ( String ( 'nitropack' ) )
99
+ }
100
+ if ( ! nitroModule ) {
101
+ return
102
+ }
93
103
// force templates to be rebuilt
94
- await build ( prerenderer )
104
+ await nitroModule . build ( prerenderer )
95
105
96
106
const routes : string [ ] = [ ]
97
107
if ( options . debug )
You can’t perform that action at this time.
0 commit comments