nextjs-prisma-client-component-import

Separate Prisma types in Next.js client components to avoid node:module errors.

9|2|Updated Mar 5, 2026
One-click install
npx skills add https://github.com/DavidTeju/shared-skills --skill nextjs-prisma-client-component-import
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nextjs-prisma-client-component-import
Source: https://github.com/DavidTeju/shared-skills/tree/main/skills/nextjs-prisma-client-component-import
Command: npx skills add https://github.com/DavidTeju/shared-skills --skill nextjs-prisma-client-component-import

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Next.js client components often fail when they import Prisma types, leading to cryptic bundling errors like node:module. This skill provides guidance to separate server and client types or use browser-safe enums to fix browser builds.

Core Features & Use Cases

  • Resolve Prisma type imports in client components without breaking builds.
  • Suggest patterns for server/client separation and type safety across Next.js apps.
  • Use Case: When a client component imports from @prisma/client, apply the recommendations to avoid bundling Node.js code.

Quick Start

Adjust Prisma type imports in your Next.js app to ensure client bundles stay browser-safe.

Frequently Asked Questions about nextjs-prisma-client-component-import

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why do Next.js client components throw node:module errors when importing Prisma types?

Next.js client components throw node:module errors because importing from @prisma/client bundles Node.js dependencies into the browser. You must separate server and client type files or import browser-safe enums to keep the client bundle node-free.

How do I fix Prisma type import issues in Next.js 14 client components?

Fix Prisma type import issues in Next.js 14 client components by separating server and client type files or using browser-safe enums. This prevents generated Prisma client code from breaking browser builds with Turbopack or webpack.

Can I use Prisma enums directly in Next.js client components?

Yes, you can use Prisma enums in Next.js client components by importing browser-safe enums. This ensures type safety across your Next.js app without introducing Node.js modules into the client bundle.

Does this approach work for both Turbopack and webpack in Next.js?

Yes, this approach works for both Turbopack and webpack in Next.js 14+ projects. Separating server and client type files ensures the client bundle remains node-free regardless of your chosen bundler.

What is the best way to make Prisma types browser-safe for Next.js?

The best way to make Prisma types browser-safe for Next.js is separating server and client type files or importing browser-safe enums. This ensures the client bundle remains node-free and prevents bundling errors.

When do I need to separate server and client types for Prisma in Next.js?

You need to separate server and client types for Prisma in Next.js when a client component imports from @prisma/client and the error mentions Client Component Browser. This indicates Node.js code is leaking into the browser bundle.