Running dev
and prod
Server at the Same Time
Both the servers use the same output directory which causes the conflict. Use a custom directory for each environment and you’re good to go.
const nextConfig: NextConfig = {
distDir: process.env.NODE_ENV === "production" ? ".next" : ".next-dev",
};