Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
2 tasks done
BlueCat918 opened this issue Feb 29, 2024 · 7 comments
Closed
2 tasks done
Assignees
Labels
bug Something isn't working next version Plan for next version

Comments

@BlueCat918
Copy link

✅ Checklist

  • I am using the latest version
  • I have searched FAQ

📄 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@[email protected]\node_modules@commitlint\config-conventional\lib\index.js from ~\node_modules.pnpm\[email protected]\node_modules\cz-git\lib\index.js not supported.
Instead change the require of ~\node_modules.pnpm@[email protected]\node_modules@commitlint\config-conventional\lib\index.js in ~\node_modules.pnpm\[email protected]\node_modules\cz-git\lib\index.js to a dynamic import() which is available in all CommonJS modules.

🔗 Reproduction link / repo:

No response

@BlueCat918 BlueCat918 added the bug Something isn't working label Feb 29, 2024
@Zhengqbbb
Copy link
Owner

ref: #159 (comment)

image

@Zhengqbbb Zhengqbbb added not bug | wontfix This is't cz-git bug and removed bug Something isn't working labels Feb 29, 2024
@BlueCat918
Copy link
Author

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

@Zhengqbbb Zhengqbbb reopened this Feb 29, 2024
@Zhengqbbb
Copy link
Owner

Zhengqbbb commented Feb 29, 2024

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

conventional-changelog/commitlint#3850


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

@Zhengqbbb Zhengqbbb added bug Something isn't working next version Plan for next version and removed not bug | wontfix This is't cz-git bug labels Feb 29, 2024
Zhengqbbb added a commit that referenced this issue Feb 29, 2024
…onfig

commitlint update to pure ESM.
Include common plugin like `@commitlint/config-conventional`
It cause cz-git loader config error

link #160
@Zhengqbbb
Copy link
Owner

Zhengqbbb commented Feb 29, 2024

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

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

npm install -D cz-git@next
image

@Mister-Hope
Copy link

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

@BlueCat918
Copy link
Author

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

Zhengqbbb added a commit that referenced this issue Mar 3, 2024
* fix(plugin-loader): to support commitlint v19 `esm` plugin extends config

commitlint update to pure ESM.
Include common plugin like `@commitlint/config-conventional`
It cause cz-git loader config error

link #160
@Zhengqbbb
Copy link
Owner

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. 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working next version Plan for next version
Projects
None yet
Development

No branches or pull requests

3 participants