Fix Prisma 7 + Turbopack RSC compatibility by adding serverExternalPackages

Next.js 16 with Turbopack bundles @prisma/client into the RSC bundle,
causing it to be treated as a client module and creating 'temporary client
references'. This triggers the 'Cannot access toStringTag on the server' error
whenever Prisma result objects are used in Server Components.

Adding serverExternalPackages tells Turbopack to treat these as native
Node.js packages and keep them out of the RSC bundle.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-25 14:23:02 +05:00
parent 5dfa79d357
commit 4821764a4f
+1
View File
@@ -3,6 +3,7 @@ import type { NextConfig } from "next";
const nextConfig: NextConfig = {
output: "standalone",
transpilePackages: ["unified", "remark-parse"],
serverExternalPackages: ["@prisma/client", "@prisma/adapter-pg", "pg"],
};
export default nextConfig;