fix(js): recognize tsconfig module `nodenext` as ESM
Current Behavior
A tsconfig module value of nodenext is treated as a CJS format, which produces a warning when built due to it being used in ESM projects.
Expected Behavior
A tsconfig module value of nodenext is now teated as an ESM format, producing no warning when built.
Related Issue(s)
Fixes https://github.com/nrwl/nx/issues/31295
The latest updates on your projects. Learn more about Vercel for GitHub.
| Project | Deployment | Preview | Updated (UTC) |
|---|---|---|---|
| nx-dev | Preview | Aug 29, 2025 3:44am |
๐ค Nx Cloud AI has analyzed the error but could not create a fix
No fix generated, but analysis is available โข View Fix โ
View your CI Pipeline Execution โ for commit 3b643599bbed132d0ae14daef81bc516d85d79a6
| Command | Status | Duration | Result |
|---|---|---|---|
nx affected --targets=lint,test,build,e2e,e2e-c... |
โ Failed | 40m 18s | View โ |
nx run-many -t check-imports check-commit check... |
โ Succeeded | 1m 56s | View โ |
nx-cloud record -- nx-cloud conformance:check |
โ Succeeded | 2s | View โ |
nx-cloud record -- nx format:check |
โ Succeeded | 6s | View โ |
nx-cloud record -- nx sync:check |
โ Succeeded | 5s | View โ |
nx documentation |
โ Succeeded | 3m | View โ |
โ๏ธ Nx Cloud last updated this comment at 2025-08-14 03:07:42 UTC
Failed check is due to failing test in angular:test on master, unclear whether or not the fix is to just update the snapshot.
Hey @JoshuaCWebDeveloper I'm not sure if this is 100% correct.
NodeNext will be ESM if the nearest package.json type is module, and/or depending on the file extension of files.
Hey @JoshuaCWebDeveloper I'm not sure if this is 100% correct.
NodeNextwill be ESM if the nearest package.json type is module, and/or depending on the file extension of files.
@Coly010 Good point. Looked at this a bit closer, format is an optional option to updatePackageJson() because it is already checking the package.json type. getUpdatedPackageJsonContent() also has logic for handling no given format.
My new solution passes a format of undefined to updatePackageJson() for the node* module types. This allows updatePackageJson() to determine the correct format (currently checks package.json, and can check file extensions in the future if it needs to). I also check every single tsconfig module option for completeness and to make it super clear what the method returns now that I'm introducing a third return type.
Should be handled now by: https://github.com/nrwl/nx/pull/31508
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.