Skip to content

yargs cannot find package.json on ESM #2122

@jopemachine

Description

@jopemachine

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'));

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions