Skip to content

Commit

Permalink
fix(platform): add handling of routes array for prerendering (analogj…
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonroberts authored and Villanuevand committed Sep 12, 2023
1 parent a75a428 commit 0faebc4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/platform/src/lib/vite-nitro-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,11 @@ export function viteNitroPlugin(
nitroConfig.prerender = {};
nitroConfig.prerender.crawlLinks = options?.prerender?.discover;

if (typeof options?.prerender?.routes === 'function') {
nitroConfig.prerender.routes = await options.prerender.routes();
const prerenderRoutes = options?.prerender?.routes;
if (Array.isArray(prerenderRoutes)) {
nitroConfig.prerender.routes = prerenderRoutes;
} else if (typeof prerenderRoutes === 'function') {
nitroConfig.prerender.routes = await prerenderRoutes();
}
}

Expand Down

0 comments on commit 0faebc4

Please sign in to comment.