Closed wangys4dev closed 8 months ago
I also faced the same issue. This issue may be related. https://github.com/commitizen/cz-cli/issues/916
Update - March 13, 2024: The workaround described below is no longer necessary. Upgrade @commitlint/cz-commitlint
to version 19.1.0
or higher and it will function correctly with commitizen
Version 19.1.0
of @commitlint/cz-commitlint
has added the required CJS export for commitizen
.
For details, see the release notes at conventional-changelog/commitlint v19.1.0.
Workaround for ESM version of commitlint:
Create an adapter module: cz-adapter.cjs
:
exports.prompter = async (inquirerIns, commit) => {
;(await import('@commitlint/cz-commitlint')).prompter(inquirerIns, commit)
}
In package.json
:
{
"config": {
"commitizen": {
"path": "./cz-adapter.cjs"
}
}
}
@frantic1048 Thanks, it works for me.
@frantic1048 This worked for me as well. Thank you.
As a reminder, upgrading @commitlint/cz-commitlint
to 19.1.0
eliminates the need for the adapter workaround mentioned above, and commitizen
will function as usual.
Steps to Reproduce
pnpm cz
Current Behavior
got error
Expected Behavior
Run commitizen normally
Affected packages
Possible Solution
3850
Context
No response
commitlint --version
@commitlint/cli@19.0.3
git --version
git version 2.44.0.windows.1
node --version
v20.11.1