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] The plugin stops working completely #334

Open
BabakScript opened this issue Mar 5, 2024 · 9 comments
Open

[BUG] The plugin stops working completely #334

BabakScript opened this issue Mar 5, 2024 · 9 comments
Assignees
Labels
help wanted Extra attention is needed

Comments

@BabakScript
Copy link

Describe the bug

The plugin stops working completely after upgrading my project with the error below:
image

Conventional Commits: require() of ES Module /workspace/node_modules/.pnpm/@commitlint+config-conventional@19.0.3/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/@commitlint+config-conventional@19.0.3/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/@commitlint+config-conventional@19.0.3/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:
{}

@BabakScript BabakScript added the help wanted Extra attention is needed label Mar 5, 2024
@geoff-harper
Copy link

I'm getting same after upgrading commitlint from 17 -> 19

@Noxdor
Copy link

Noxdor commented Mar 8, 2024

I am having the same issue, it won't load the config neither as module or commonjs.

@Noxdor
Copy link

Noxdor commented Mar 8, 2024

I fixed it by downgrading @commitlint/cli, @commitlint/config-conventional and @commitlint/types to version 18. Clearly an issue with v19.

@BabakScript
Copy link
Author

I think it will be fixed soon after the release of this PR: conventional-changelog/commitlint#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",

   }

@maquejp
Copy link

maquejp commented May 6, 2024

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

@luffynando
Copy link

any progress?

@yi-Xu-0100
Copy link
Collaborator

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! ❤️

@vivaxy
Copy link
Owner

vivaxy commented Jun 25, 2024

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

@vivaxy
Copy link
Owner

vivaxy commented Jun 25, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

7 participants