Using Middleware with output: "export"
Unanswered
Sun bear posted this in #help-forum
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
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
@Sun bear 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
middleware is not supported with static export.
you should look for hosting that support node/docker/serverless
you should look for hosting that support node/docker/serverless