-
Notifications
You must be signed in to change notification settings - Fork 74
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
Cannot find module 'conventional-changelog-*' #589
Comments
in order for us to give any priority to this in the context of semantic-release, we need to eliminate the context of the monorepo from the equation. the use of if you want us to investigate this further in the context of the semantic-release project, we need you to provide a public minimal reproduction that does not include the monorepo structure. if it can not be reproduced in that context, this issue needs to be addressed outside of the semantic-release project since we do not officially support monorepos. that may mean that that you need to move this issue either to |
@travi Got it. The following reproduction is based on the latest MVPgit clone https://github.com/1aron/commit-analyzer
git checkout issue-import-from-esm
npm i
npm test load-parser-config › undefined Load "techor" config
Rejected promise returned by test. Reason:
Error {
code: 'MODULE_NOT_FOUND',
message: 'Cannot find module \'conventional-changelog-techor\'',
}
Error: Cannot find module 'conventional-changelog-techor'
at importFrom (file:///Users/aron/commit-analyzer/node_modules/import-from-esm/index.js:100:17)
at async default (file:///Users/aron/commit-analyzer/lib/load-parser-config.js:28:76)
at async loadConfig (file:///Users/aron/commit-analyzer/test/load-parser-config.test.js:32:6)
─
1 test failed If you remove the The error is expected, load-parser-config › undefined Load "techor" config
Rejected promise returned by test. Reason:
TypeError {
message: '((intermediate value) || (intermediate value)) is not a function',
}
TypeError: ((intermediate value) || (intermediate value)) is not a function
at default (file:///Users/aron/commit-analyzer/lib/load-parser-config.js:28:107)
at async loadConfig (file:///Users/aron/commit-analyzer/test/load-parser-config.test.js:32:6)
─
1 test failed |
ok, so i think i understand the difference from the known working situations. importing a common-js module or an esm module are supported and known to be working. your package for your preset is dual-mode, exporting both cjs and esm. removing the is there a reason why you need that specific package to be dual mode rather than esm-only (like the official conventional-changelog presets)? i can't think of a benefit of exporting both from a preset package like this. if you do think this should be supported, i think this is a specific request for |
@travi The primary motivation for offering both ESM and CJS exports in an open-source package is to ensure compatibility. I believe it's crucial for the package to be importable without issues when using the "exports" configuration with multiple entry points. At the very least, 'import-from' functions smoothly. I could have simplified In the past, semantic-release supported importing its own configuration in monorepo, such as |
dual mode packages can be useful for compatibility, but i struggle to understand why a package for a conventional-changelog preset has a need for that level of compatibility. because of the async function breaking change, your package can also have a breaking change for switching from cjs to esm-only, if you choose to. there should not be situations for that package where you need that capability.
i'm trying to be patient with your request, but please understand that this is an OSS project maintained by volunteer maintainers. we are the ones that need to be convinced which options are worth accepting and maintaining long term. i honestly do not see value in doing additional work to support dual-mode preset packages when we do support both cjs-only and esm-only packages and you could simply choose to publish one or the other. you are welcome to submit an issue against |
Dual-mode support is of course not necessary, my primary concern lies in ensuring that Node's general import behavior functions as expected. It appears that the issue indeed stems from 'import-from-esm'. As a temporary solution, I will revert the package to version 11.0 by modifying the {
"resolutions": {
"@semantic-release/commit-analyzer": "11.0.0"
}
} I genuinely appreciate all the contributions made by open-source contributors to this ecosystem. No offense is intended. |
Likewise, we appreciate the heads up. Just trying to direct you to where this can be best handled. I can agree with the desire to be consistent, it just isn't something that I think we can justify as a priority for the semantic-release project. @sheerlox might be open to it for |
@1aron for the first case, I'm guessing the issue is coming from
If you still feel this is an issue with Regarding the second case, let's track this in the issue you already opened (sheerlox/import-from-esm#92). |
Everything worked fine before v11.1; since @sheerlox introduces the
import-from-esm
#537, and it's behavior became unreliable.To reproduce
This error occurs in both cases.
Case 1
Clone my repo and run the test
The reproductions above are all in the same monorepo, I think this is not entirely a bug caused by the monorepo, but caused by
import-from
being changed toimport-from-esm
.conventional-changelog-techor
is thepackages/conventional-changelog-config
in the monorepo. This error is not caused by its own error, even if you useconventional-changelog-angular
instead and specifypreset 'angular'
.Case 2
It's about my contribution #588. Perform the following steps on latest master branch:
Add the new
test/presets.test.js
npm test
If I remove the
"exports": { ... }"
section from "node_modules/conventional-changelog-techor/package.json", it will work.So this is a problem with
import-from-esm
itself, regardless of whether it is a monorepo or not.When I change
import-from-esm
back toimport-from
everything still works. This means that the changes in v11.1 did not include tests for the new functionality (#537), and these tests would have failed before v11.1. Changes add a lot of uncertainty.Suggestion
Reverts:
Potentially relevant
The text was updated successfully, but these errors were encountered: