</>CodeWithKarani
All of Web & JavaScript
Web & JavaScript

TypeScript & Tooling

Types, module resolution, ESM/CJS and the config that fights you.

7 articles

Web & JavaScript9 min read

ERR_REQUIRE_ESM on Vercel but not locally: the Next.js 16.2 monorepo bug

Your Next.js build passes and the Vercel deploy 500s with ERR_REQUIRE_ESM. Here is the missing .next/package.json that causes it, and three workarounds that hold.

Read
Web & JavaScript8 min read

Dynamic Code Evaluation Not Allowed in Edge Runtime: The Next.js Middleware Fix

Mongoose and jsonwebtoken break Next.js middleware with a dynamic code evaluation error that names no package. Here is the real cause and the fix for each version.

Read
Web & JavaScript9 min read

Why Next.js Never Warned You About That Non-Serializable Client Prop

TS71007 only runs in your editor, and only on named exports. Two stacked gaps mean nothing in CI stops a bad Client Component prop. Here is a gate that actually fails a build.

Read
Web & JavaScript7 min read

ERR_REQUIRE_ESM After a Next.js Upgrade: The CJS/ESM Interop Change Nobody Flagged

A routine Next.js minor bump throws ERR_REQUIRE_ESM on an ESM-only package that worked yesterday. Here is why the interop rules changed and the three real fixes.

Read
Web & JavaScript8 min read

Cannot find module '@/...': why path aliases break across transpilePackages

A tsconfig path alias is a compile-time hint that lives inside one package. Import that package into another and the alias evaporates. Here is why, and the fix that holds.

Read
Web & JavaScript6 min read

moduleResolution 'NodeNext' Breaks Next.js Type Imports: Use 'bundler'

Setting moduleResolution to nodenext makes TypeScript report 'Cannot find module next/navigation'. Here is why NodeNext is too strict for Next.js and the tsconfig to use instead.

Read
Web & JavaScript7 min read

next/dynamic Named Imports Cause Hydration Errors: The Real Fix

That hydration error from a dynamically imported library is often an import bug in disguise. Why named exports resolve to undefined, and the .then() plus client-wrapper fix.

Read