Zhengqbbb / cz-git

cz-git | czg 🛠️ DX first and more engineered, lightweight, customizable, standard output format Commitizen adapter and CLI
https://cz-git.qbb.sh
MIT License
1.05k stars 39 forks source link

[Bug report] 使用@commitlint/config-conventional^19出现异常 #160

Closed BlueCat918 closed 6 months ago

BlueCat918 commented 6 months ago

✅ Checklist

📄 System Info

System:
    OS: Windows 10 10.0.19045
    Memory: 5.86 GB / 15.86 GB
  Binaries:
    Node: 18.19.0
    pnpm: 8.15.4
  npmPackages:
    @commitlint/cli: ^19.0.3
    @commitlint/config-conventional: ^19.0.3
    commitizen: ^4.3.0
    cz-git: ^1.8.0
    vite: ^5.1.4

🔎 Description

未使用全局配置,使用@commitlint/config-conventional^19的情况下出现以下异常,降级为^18异常消失。

require() of ES Module ~\node_modules.pnpm\@commitlint+config-conventional@19.0.3\node_modules\@commitlint\config-conventional\lib\index.js from ~\node_modules.pnpm\cz-git@1.8.0\node_modules\cz-git\lib\index.js not supported. Instead change the require of ~\node_modules.pnpm\@commitlint+config-conventional@19.0.3\node_modules\@commitlint\config-conventional\lib\index.js in ~\node_modules.pnpm\cz-git@1.8.0\node_modules\cz-git\lib\index.js to a dynamic import() which is available in all CommonJS modules.

🔗 Reproduction link / repo:

No response

Zhengqbbb commented 6 months ago

ref: https://github.com/Zhengqbbb/cz-git/issues/159#issuecomment-1961354215

image
BlueCat918 commented 6 months ago

使用的是.commitlintrc.cjs默认配置模板,只添加了extends: ['@commitlint/config-conventional'] 配置项

Zhengqbbb commented 6 months ago

commitlint 从 v19 开始全面使用 ESM 规范而没有提供 CJS 的兼容层 🫠

https://github.com/conventional-changelog/commitlint/pull/3850


CleanShot 2024-02-29 at 21 09 03@2x

Zhengqbbb commented 6 months ago

@BlueCat918 我已经升级了 loader 中 commitlint 依赖,并发布了预发版本 1.8.1-beta.3,以支持加载 extends ESM 项目配置 但我仍然需要需要一段时间在其他项目上进行测试,预计周末完成升级

当前你的项目可以使用下面命令进行升级,如果有问题的话,欢迎前来告知 😁 再次感谢你的提醒

npm install -D cz-git@next
image
Mister-Hope commented 6 months ago

汇报一下,1.8.1-beta.3 在我的项目里没有问题

BlueCat918 commented 6 months ago

@Zhengqbbb 升级至 1.8.1-beta.3 问题消失,感谢。

Zhengqbbb commented 6 months ago

The latest version 🌟(v1.9.0)🌟 should be resolve this issue request , please have a try. 💪 👀 Let me know if there are still any issues. 🎉