Next.js Discord

Discord Forum

"dynamic" matcher doesn't work?

Unanswered
Rhinelander posted this in #help-forum
Open in Discord
RhinelanderOP
const allow_paths = ["api", "_next/static", "_next/image", "favicon.ico"];
console.log("/((?!api|_next/static|_next/image|favicon.ico).*)");
console.log("/((?!" + allow_paths.join("|") + ").*)");
export const config = {
  // matcher: "/((?!api|_next/static|_next/image|favicon.ico).*)",
  matcher: "/((?!" + allow_paths.join("|") + ").*)",
};


it logs two identical lines, yet first works as a matcher, and second doesn't

0 Replies