Skip to content

Commit

Permalink
fix(platform): add handling of routes array for prerendering (#227)
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonroberts authored Jan 19, 2023
1 parent 5d94827 commit 4f2afef
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 4f2afef

Please sign in to comment.