Node.js ESM __dirname is not defined in ES module scope
Deterministic patch indexed for AI coding agents (Cursor, Claude Code, Cline, Windsurf, OpenDevin).
Root Cause: Reconstruct __dirname using import.meta.url.
typescript fix --latest
Deterministic patch indexed for AI coding agents (Cursor, Claude Code, Cline, Windsurf, OpenDevin).
+ import { fileURLToPath } from 'url';
+ import { dirname } from 'path';
+ const __filename = fileURLToPath(import.meta.url);
+ const __dirname = dirname(__filename);
curl -X POST https://agentnow.in/api/v1/query \
-H "Content-Type: application/json" \
-d '{"error": "Node.js ESM __dirname is not defined in ES module scope"}'