When converting a Node CommonJS module to an ES module, __dirname
stops working.
Add this line to make it work again:
import { dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
const __dirname = dirname(fileURLToPath(import.meta.url));