Skip to content

Commit

Permalink
feat: enhance prerender.ignore
Browse files Browse the repository at this point in the history
  • Loading branch information
thezzisu committed Mar 7, 2023
1 parent a322405 commit 3297765
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/prerender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,11 @@ export async function prerender(nitro: Nitro) {

// Check for explicitly ignored routes
for (const ignore of nitro.options.prerender.ignore) {
if (route.startsWith(ignore)) {
if (typeof ignore === "string") {
if (route.startsWith(ignore)) {
return false;
}
} else if (ignore.test(route)) {
return false;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/types/nitro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ export interface NitroOptions extends PresetOptions {
devErrorHandler: NitroErrorHandler;
prerender: {
crawlLinks: boolean;
ignore: string[];
ignore: (string | RegExp)[];
routes: string[];
};

Expand Down

0 comments on commit 3297765

Please sign in to comment.