Closed zigang93 closed 2 months ago
I apologize, but at the beginning of the project, I started experimenting with compatibility in this ESM ISSUE which proved infeasible due to upstream dependencies:
https://github.com/commitizen/cz-cli/blob/28d96ef98d702dc48c7a19d44dce710ab80911ba/package.json#L84 https://github.com/SBoudrias/Inquirer.js/tree/inquirer%408.2.4
However, there is still a way to achieve this, which is to use @esbuild-kit/cjs-loader to convert the CJS compatibility layer and provide it to the cz-git configuration. https://github.com/element-plus/element-plus/blob/dev/commitlint.config.js playground: https://github.com/Zhengqbbb/czgit-playground/tree/commitizen-esm
BTW I'm curious why it's necessary to use commitlint.config.mjs
. Emmm as far as I know, commitlint.config.cjs
can also achieve the validation effect.
btw, I able to make it work with .js
only..
and make my monorepo root packages.json with "type": module"
..
I had tried to change .cjs
but it don't work..
I want to use .mjs
because I don't want to use "type": module"
in my packages.json.. it will force my source code to use esm only.. mjs is standalone config file.. I saw @commitlint/cli
got support mjs
..
lastly, from my understanding.. cjs is use for commonjs ? it shouldn't support modern import statement
make my monorepo root packages.json with
"type": module"
. I had tried to change.cjs
but it don't work..
Oh that is something wrong. It should work. If you try to read js
in your type:modules project, it will use the ESM paradigm to read it. However, if your file is cjs
, it will forcibly use the CJS method to read the configuration.
Have a reproduction repo 👀 ?
make my monorepo root packages.json with
"type": module"
. I had tried to change.cjs
but it don't work..Oh that is something wrong. It should work. If you try to read
js
in your type:modules project, it will use the ESM paradigm to read it. However, if your file iscjs
, it will forcibly use the CJS method to read the configuration.Have a reproduction repo 👀 ?
I try reproduce for u :) will update to u within 2 days
💭 Describe the feature
support esm module file. using
import
statement💡 Proposed Solution
No response