So I have a typescript app with type set to module in package.json.
so far everything has worked great, but now after I've imported a google voice api everything breaks when trying to run the app.
> node build --prod
file:///opt/jap/server/build/index.js:132416
var googleProtoFilesDir = path.join(__dirname, "..", "..", "protos");
^
ReferenceError: __dirname is not defined in ES module scope
This file is being treated as an ES module because it has a '.js' file extension and '/opt/jap/server/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
Kind of makes sense I guess, but I can't change the type of the app, and the .js file is not something I can control as it is in a dependency.
I've tried adding "types": ["node"] to compilerOptions in tsconfig.json without luck, and I've added "@types/node": "^16.9.1" as a dependency, also without any success.
So is there any obvious solution to this?
also: I do have "esModuleInterop": true in my tsconfig.json