errors/api-routes-static-export.mdx
The "API Routes in Static Export" warning is typically raised when an exportPathMap path is matched to an API route while trying to statically export a Next.js application via the next export command. This command disables API routes as it is designed for a static-only setup.
Running next export is not necessary to make your application static. Pages in your application that do not have server-side data dependencies will be automatically statically optimized when you run next build. This includes pages powered by getStaticProps.
To resolve this issue, you have two main options:
next build command instead of next export if you're deploying your application on platforms that don't require next export. For example, Vercel is a popular hosting platform for Next.js applications that supports this feature.next export, make sure to remove any paths that use API routes from your exportPathMap in your next.config.js file.