const fs = require("fs"); const path = require("path"); /** * Script to add .js extensions to import/export statements in compiled JavaScript files * This fixes ES module resolution issues in Node.js */ function addJsExtensions(filePath) { try { const content = fs.readFileSync(filePath, "utf8"); // Regex to match import/export statements without .js extensions // Matches: from "./some/path" or from '../some/path' but not from 'external-package' const importExportRegex = /(import|export)(.*?from\s+['"])(\.\.?\/[^'"]*?)(?