Skip to content

Node.js v25.7 breaks yargs v17 #2509

@nicolo-ribaudo

Description

@nicolo-ribaudo

Ref nodejs/node#61971

This is arguably a breaking change that Node.js shipped in a minor release and not yargs' fault. However, it is due to yargs v17 doing something quite weird.

I know that v17 is not the latest version, but I'm still opening this issue as it's by far the most downloaded one:

Image

So, what caused yargs to break? yargs v17 has an extensionless ./yargs CommonJS file in the root, and type: "module" in package.json. Node.js was considering all extensionless files as CommonJS, while now it's respecting what is defined in the package.json file. This matches what Node.js was already documenting in https://nodejs.org/docs/latest-v24.x/api/esm.html (see the "ESM_FILE_FORMAT" algorithm).

Would it be possible to release a new yargs v17 release, that simply renames that file from yargs to yargs.cjs (and updates the package.json#exports accordingly)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions