Open IslamWahid opened 1 year ago
@inxilpro could you please have a look. I've a problem using typeorm which is using your package internally so when I build my app as esm I get an error
Runtime.UnhandledPromiseRejection: 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
Same issue for me, but return to normal after replacing __dirname
.
Suggestion: Is it better to change it like this?
var dirname = '';
try {
dirname= __dirname
} catch {
dirname = process.env.APP_ROOT_PATH;
}
var lib = require('./lib/app-root-path.js');
module.exports = lib(dirname);