fix(version): support ESM and new v8+ conventional-changelog preset API#4302
Merged
JamesHenry merged 2 commits intolerna:mainfrom Mar 11, 2026
Merged
fix(version): support ESM and new v8+ conventional-changelog preset API#4302JamesHenry merged 2 commits intolerna:mainfrom
JamesHenry merged 2 commits intolerna:mainfrom
Conversation
conventional-changelog preset packages v8+ are ESM-only and use a new config API shape (parser/writer/commits/whatBump instead of parserOpts/writerOpts/gitRawCommitsOpts/recommendedBumpOpts). This adds dynamic import() fallback for ESM modules and normalizes the new API shape to the legacy format expected by conventional-changelog-core and conventional-recommended-bump. Closes lerna#4021
|
View your CI Pipeline Execution ↗ for commit aac0ed8
☁️ Nx Cloud last updated this comment at |
Node.js 22+ can require() ESM modules without throwing ERR_REQUIRE_ESM,
but returns a module namespace object { __esModule, default, ... }
instead of the default export directly. Extract .default when this
interop wrapper is detected.
JamesHenry
approved these changes
Mar 11, 2026
1 task
literat
added a commit
to alma-oss/spirit-design-system
that referenced
this pull request
Mar 31, 2026
…lerna.json * current lerna version finally support esm for conventional commits * @see: lerna/lerna#4302
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
🤖 This PR was created by @AI-JamesHenry, an AI assistant account guided and overseen by @JamesHenry.
Summary
import()fallback whenrequire()fails withERR_REQUIRE_ESM(Node 20), enabling support for ESM-only conventional-changelog presets (v8+)__esModulemodule namespace objects returned byrequire()of ESM modules on Node 22+ (whererequire()succeeds but returns a namespace wrapper instead of the default export)parser/writer/commits/whatBump) to the legacy format (parserOpts/writerOpts/gitRawCommitsOpts/conventionalChangelog/recommendedBumpOpts) expected byconventional-changelog-core@5andconventional-recommended-bump@7Reproduction
conventional-changelog-conventionalcommitsv8+ (and other preset packages) switched to:"type": "module") — on Node 20,require()throwsERR_REQUIRE_ESM; on Node 22+,require()succeeds but returns a module namespace object{ __esModule, default, ... }instead of the default export{ parser, writer, commits, whatBump }instead of{ parserOpts, writerOpts, gitRawCommitsOpts, recommendedBumpOpts, conventionalChangelog }This caused Lerna to either fail to load the preset entirely (ESM error) or produce degraded changelogs (missing version links, missing "Bug Fixes" section headings, missing "closes" references).
Verified with pkg.pr.new release (
aac0ed8)conventionalcommits@7.0.2(CJS, old API)[1.0.1](...)### Bug Fixes[TEST-123](https://myBugTracker.com/TEST-123)conventionalcommits@9.3.0(ESM, new API)[1.0.1](...)### Bug Fixes[TEST-123](https://myBugTracker.com/TEST-123)Node version coverage
require()of ESMERR_REQUIRE_ESMimport()fallback extracts.default{ __esModule, default }__esModulecheck extracts.default__esModulecheckTest plan
supports new v8+ preset API with parser/writer/whatBump(recommendVersion)normalizes new v8+ preset API to legacy format(getChangelogConfig)supports new v8+ preset API for changelog generation(updateChangelog)Closes #4021
Closes #4089
Closes #4184