vscode-conventional-commits
vscode-conventional-commits copied to clipboard
[BUG] The plugin stops working completely
Describe the bug
The plugin stops working completely after upgrading my project with the error below:
Conventional Commits: require() of ES Module /workspace/node_modules/.pnpm/@[email protected]/node_modules/@commitlint/config-conventional/lib/index.js from /home/node/.vscode-server/extensions/vivaxy.vscode-conventional-commits-1.25.0/dist/extension.js not supported. Instead change the require of index.js in /home/node/.vscode-server/extensions/vivaxy.vscode-conventional-commits-1.25.0/dist/extension.js to a dynamic import() which is available in all CommonJS modules.
I'm using devContainer, PNPM, and node. Whenever I click on the plugin button it shows the error I mentioned in the error box in the vsCode.
Application logs
[info] Extension Activated
[info] vscode.env.language: en
[info] last used version: 1.25.0
[info] Conventional commits started.
[info] VSCode version: 1.87.0
[info] Git version: 1.0.0
[info] VSCode Conventional Commits version: 1.25.0
[info] conventionalCommits.autoCommit: true
[info] conventionalCommits.silentAutoCommit: false
[info] conventionalCommits.emojiFormat: code
[info] conventionalCommits.gitmoji: false
[info] conventionalCommits.lineBreak:
[info] conventionalCommits.promptBody: true
[info] conventionalCommits.promptCI: false
[info] conventionalCommits.promptFooter: true
[info] conventionalCommits.promptScopes: true
[info] conventionalCommits.scopes:
[info] conventionalCommits.showEditor: false
[info] conventionalCommits.showNewVersionNotes: true
[info] conventionalCommits.editor.keepAfterSave: false
[info] git.enableSmartCommit: false
[info] git.smartCommitChanges: all
[info] git.postCommitCommand: none
[info] _arg: /workspace
[info] git.repositories: /workspace
[info] workspaceFolders: /workspace
[error] commitlint: The cwd is /workspace
[error] commitlint: Error [ERR_REQUIRE_ESM]: require() of ES Module /workspace/node_modules/.pnpm/@[email protected]/node_modules/@commitlint/config-conventional/lib/index.js from /home/node/.vscode-server/extensions/vivaxy.vscode-conventional-commits-1.25.0/dist/extension.js not supported.
Instead change the require of index.js in /home/node/.vscode-server/extensions/vivaxy.vscode-conventional-commits-1.25.0/dist/extension.js to a dynamic import() which is available in all CommonJS modules.
at h._load (/vscode/vscode-server/bin/linux-arm64/019f4d1419fbc8219a181fab7892ebccf7ee29a2/out/vs/workbench/api/node/extensionHostProcess.js:173:5634)
at n._load (/vscode/vscode-server/bin/linux-arm64/019f4d1419fbc8219a181fab7892ebccf7ee29a2/out/vs/workbench/api/node/extensionHostProcess.js:170:29786)
at t._load (/vscode/vscode-server/bin/linux-arm64/019f4d1419fbc8219a181fab7892ebccf7ee29a2/out/vs/workbench/api/node/extensionHostProcess.js:135:35289)
at Module.require (/home/node/.vscode-server/extensions/humao.rest-client-0.25.1/dist/extension.js:12:12993)
at /home/node/.vscode-server/extensions/vivaxy.vscode-conventional-commits-1.25.0/dist/extension.js:22078:19
at Array.reduce (<anonymous>)
at loadExtends (/home/node/.vscode-server/extensions/vivaxy.vscode-conventional-commits-1.25.0/dist/extension.js:22075:16)
at Object.resolveExtends [as default] (/home/node/.vscode-server/extensions/vivaxy.vscode-conventional-commits-1.25.0/dist/extension.js:22061:22)
at Object.load [as default] (/home/node/.vscode-server/extensions/vivaxy.vscode-conventional-commits-1.25.0/dist/extension.js:21971:47)
[info] commitlintRuleConfigs:
{}
[info] Conventional commits started.
[info] VSCode version: 1.87.0
[info] Git version: 1.0.0
[info] VSCode Conventional Commits version: 1.25.0
[info] conventionalCommits.autoCommit: true
[info] conventionalCommits.silentAutoCommit: false
[info] conventionalCommits.emojiFormat: code
[info] conventionalCommits.gitmoji: false
[info] conventionalCommits.lineBreak:
[info] conventionalCommits.promptBody: true
[info] conventionalCommits.promptCI: false
[info] conventionalCommits.promptFooter: true
[info] conventionalCommits.promptScopes: true
[info] conventionalCommits.scopes:
[info] conventionalCommits.showEditor: false
[info] conventionalCommits.showNewVersionNotes: true
[info] conventionalCommits.editor.keepAfterSave: false
[info] git.enableSmartCommit: false
[info] git.smartCommitChanges: all
[info] git.postCommitCommand: none
[info] _arg: /workspace
[info] git.repositories: /workspace
[info] workspaceFolders: /workspace
[error] commitlint: The cwd is /workspace
[error] commitlint: Error [ERR_REQUIRE_ESM]: require() of ES Module /workspace/node_modules/.pnpm/@[email protected]/node_modules/@commitlint/config-conventional/lib/index.js from /home/node/.vscode-server/extensions/vivaxy.vscode-conventional-commits-1.25.0/dist/extension.js not supported.
Instead change the require of index.js in /home/node/.vscode-server/extensions/vivaxy.vscode-conventional-commits-1.25.0/dist/extension.js to a dynamic import() which is available in all CommonJS modules.
at h._load (/vscode/vscode-server/bin/linux-arm64/019f4d1419fbc8219a181fab7892ebccf7ee29a2/out/vs/workbench/api/node/extensionHostProcess.js:173:5634)
at n._load (/vscode/vscode-server/bin/linux-arm64/019f4d1419fbc8219a181fab7892ebccf7ee29a2/out/vs/workbench/api/node/extensionHostProcess.js:170:29786)
at t._load (/vscode/vscode-server/bin/linux-arm64/019f4d1419fbc8219a181fab7892ebccf7ee29a2/out/vs/workbench/api/node/extensionHostProcess.js:135:35289)
at Module.require (/home/node/.vscode-server/extensions/humao.rest-client-0.25.1/dist/extension.js:12:12993)
at /home/node/.vscode-server/extensions/vivaxy.vscode-conventional-commits-1.25.0/dist/extension.js:22078:19
at Array.reduce (<anonymous>)
at loadExtends (/home/node/.vscode-server/extensions/vivaxy.vscode-conventional-commits-1.25.0/dist/extension.js:22075:16)
at Object.resolveExtends [as default] (/home/node/.vscode-server/extensions/vivaxy.vscode-conventional-commits-1.25.0/dist/extension.js:22061:22)
at Object.load [as default] (/home/node/.vscode-server/extensions/vivaxy.vscode-conventional-commits-1.25.0/dist/extension.js:21971:47)
[info] commitlintRuleConfigs:
{}
I'm getting same after upgrading commitlint from 17 -> 19
I am having the same issue, it won't load the config neither as module or commonjs.
I fixed it by downgrading @commitlint/cli, @commitlint/config-conventional and @commitlint/types to version 18. Clearly an issue with v19.
I think it will be fixed soon after the release of this PR: https://github.com/conventional-changelog/commitlint/pull/3953
For now, as @geoff-harper and @Noxdor suggested downgrade to the latest stable version as below solve the issue:
"devDependencies": {
"@commitlint/cli": "^18.6.1",
"@commitlint/config-conventional": "^18.6.1",
}
I have the same issue with the following version...
"@commitlint/cli": "^19.3.0", "@commitlint/config-conventional": "^19.2.2",
I downgraded to 18.6.1and I do not have the error shown anymore...
Any idea when it will the extension will support 19.x ?
I need to deliver a cli for a dev team to impose strict version so, I need to see if the update will fit our planning. Thank you
any progress?
Sorry everyone, I haven't been able to find time to check these issues recently. The plugin seems to work fine in my personal use. I feel like I haven't had any projects that need to use node recently, and I just used the default splicing and filling function to facilitate my git commit message. 🤔
Considering that I don't have time to fix this for now, and this problem seems very serious, I am very much looking forward to and thanking anyone who has tried to fix it to submit a PR, and I will pass it and perform automatic testing. ❤️
Finally, thank you all for liking this plugin. If there is a better and faster way to fix it, I also look forward to your comments! ❤️
It seems that commitlint had migrate their code base to ESM. Reading commitlint is not supported since commitlint@19. I've tried to make a PR to fix this. https://github.com/vivaxy/vscode-conventional-commits/pull/340 This PR use @commitlint/load@19, which can handle ESM. But I cannot figure out how VSCode Extension can use @commitlint/load@19 which is also an ESM module. Help warnted.
@BabakScript I can reproduce the issue that commitlint config is not read correctly with commitlint@19. But the extesion did not stop working. Can you provide the minial repo that reproduce the issue that the extesion stops working? Please also provide node version, pnpm version. Thanks.