commitizen / commitizen/cz-cli

Error [ERR_REQUIRE_ESM]: require() of ES Module

未关闭
#916 8 条评论 11 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
JavaScript
星标
17.5k
派生
566
平均合并
8 小时 16 分钟
30 天内合并 PR
1

描述

when trying to build custom commitizen prompt configs in node >14 where

```package.json
{
"type": "module",
}
```

it throws an error
```
require() of ES Module /custom-cz.js from /node_modules/commitizen/dist/commitizen/adapter.js not supported.
Instead change the require of index.js in /node_modules/commitizen/dist/commitizen/adapter.js to a dynamic import() which is available in all CommonJS modules.
```

```custom-cz.js
import { configLoader } from 'commitizen';
const config = configLoader.load();
```

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。