๐๐ถ๐ ๐ก๐ผ๐ฑ๐ฒ.๐ท๐ ๐๐ฆ๐ ๐๐ฟ๐ฟ๐ผ๐ฟ๐ ๐๐ถ๐๐ต ๐๐น๐ฎ๐๐ฑ๐ฒ
Node.js module errors waste time. You see ERR_REQUIRE_ESM. You edit the wrong file. The problem lives in your config.
AI often suggests a full rewrite. This is a mistake. Feed Claude your config and the error.
Force the AI to classify the root cause first. Use these categories:
- CJS consumer, ESM dependency
- ESM consumer using require
- File extension mismatch
- TS config mismatch
- Export map error
Use a script to gather context. It checks your package.json. It checks your file extensions. Paste the result into Claude.
TypeScript errors often hit in production. Compare tsconfig and package.json. Use NodeNext for both fields.
For ESM-only packages, use dynamic imports. This avoids a full project conversion.
Test your prompts. Build a bug on purpose. Confirm the AI finds the right cause.