I can't setup vercel Analytics on my project and I think it's because of the middleware from next-intl, despite my config where I have _vercel in it, the problem still persists, do you have a solution?
middleware.ts
import { NextRequest, NextResponse } from "next/server";
import { nextIntlMiddleware } from "./middleware/next-intl-middleware";
import { authMiddleware } from "./middleware/authMiddleware";
import { locales } from "./navigation";
export const middleware = async (req: NextRequest, res: NextResponse) => {
const excludePattern = "^(/(" + locales.join("|") + "))?/admin/?.*?$";
const publicPathnameRegex = RegExp(excludePattern, "i");
const isPublicPage = !publicPathnameRegex.test(req.nextUrl.pathname);
const nextIntlMiddlewareResponse = nextIntlMiddleware(req);
if (isPublicPage) {
return nextIntlMiddlewareResponse;
} else {
return authMiddleware(req);
}
};
export const config = {
matcher: [
"/((?!api|_next/static|_next/image|assets|favicon.ico|logo.png|sw.js|_vercel).*)",
],
};
