-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
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:
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)?