@commitlint/config-nx-scopes | Error [ERR_REQUIRE_ESM]: require() of ES Module Not Supported
apurvaojas opened this issue · comments
Apurva Ojas commented
Steps to Reproduce
1. Node >= 18
2. Using `@commitlint/config-nx-scopes`
3. Throwing error
(node:35973) [DEP0151] DeprecationWarning: No "main" or "exports" field defined in the package.json for /.../../node_modules/@commitlint/config-nx-scopes/ resolving the main entry point "index.js", imported from /.../../.commitlintrc.js.
Default "index" lookups for the main are deprecated for ES modules.
In package.json
of @commitlint/config-nx-scopes
{
"name": "@commitlint/config-nx-scopes",
"type": "module", // ==> Module Defined but no main or exports defined
"version": "19.0.3",
"description": "Shareable commitlint config enforcing nx project names as scopes",
"files": [
"index.js"
]
}
Current Behavior
No response
Expected Behavior
Should work, without throwing errors.
Affected packages
- cli
- core
- prompt
- config-angular
Possible Solution
No response
Context
No response
commitlint --version
@commitlint/cli@19.0.3
git --version
2.34.1
node --version
v18.19.0
大麦 commented
The new version has the same error, and the downgraded version to version 17.4.2 can be used normally, but I am sorry that other versions have not been tested
Denis Hernandez commented
Same was happening to me, but I've removed the node_modules
folder, run pnpm install
and now I don't get the error message when committing.