Are modules loaded twice in Next.js?

Next.js v15.4 with App Router

I'm using prisma for database access in my Next.js application. The prisma client should be a singleton, so I implemented it according to the following site.

https://www.prisma.io/docs/orm/more/help-and-troubleshooting/nextjs-help

However, in the production environment, this code is executed twice and two clients are created.

// lib/prisma.ts
import { PrismaClient } from "@prisma/client";

console.log("loading lib/prisma.ts");  // This log is output twice during startup!!

const globalForPrisma = global as unknown as { prisma: PrismaClient };

export const prisma = globalForPrisma.prisma || new PrismaClient();

if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = prisma;

I solved this issue by removing the production if statement from my code and always storing the prisma client in a global object.

- if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = prisma;
+ globalForPrisma.prisma = prisma;

This problem started after I added a server action to my app. Do server actions get treated specially, such as being run in a different context than normal route handlers? Is this behavior a Next.js specification ?