Next.js Discord

Discord Forum

Using Middleware with output: "export"

Unanswered
Sun bear posted this in #help-forum
Open in Discord
Sun bearOP
Hi, is there a way for me to use middleware or approach the middleware differently so that I can use output:"export" in my next.config? My middleware is for Clerk which just checks for public routes, but I can't run it using output: "export" which I need since I'm building a chrome extension.

here's my middleware.ts that lives in the root, the rest of the application is pretty much the next boilerplate with a ClerkProvider wrapper (which does nothing):
import { authMiddleware } from "@clerk/nextjs";

export default authMiddleware({
publicRoutes: ["/"],
});

export const config = {
matcher: ["/((?!.+\.[\w]+$|_next).)", "/", "/(api|trpc)(.)"],
};

this is the error I get:
⨯ Middleware cannot be used with "output: export" See more info here: https://nextjs.org/docs/advanced-features/static-html-export

1 Reply