Related issue: avajs/ava#2942
In this code, yargs's platform-shims/esm.mjs takes different value on mainFilename with platform-shims/cjs.ts.
And in my thought, because the line stores a wrong value in mainFilename in ESM, yargs cannot find package.json in the kPkgUp.
Maybe, I think this line needs to be changed like below or something.
const mainFilename = __dirname.substring(0, __dirname.lastIndexOf('node_modules'));