Skip to content

Support ESM for custom changelog and commit options#1774

Merged
Andarist merged 2 commits into
mainfrom
support-es-module
Feb 28, 2026
Merged

Support ESM for custom changelog and commit options#1774
Andarist merged 2 commits into
mainfrom
support-es-module

Conversation

@bluwy
Copy link
Copy Markdown
Member

@bluwy bluwy commented Nov 18, 2025

fix #1406
fix #1510

Use import() instead of require() so it supports ESM too. Dynamic imports are supported since node 13.2 which I believe is already covered.

I also manually tested the return value of import() compared to require(), and added a nested .default check to maintain backwards compatibility. When we support ESM, we can decide whether we want to support export const getReleaseLine = ... for example so it doesn't have to be wrapped in a default-exported object. In this PR, I allowed it which required the nested .default check.

While this change is also indirectly fixed in next #1482, I figured it doesn't hurt to fix in main first.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Nov 18, 2025

🦋 Changeset detected

Latest commit: 7226ebc

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@changesets/apply-release-plan Minor
@changesets/cli Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov
Copy link
Copy Markdown

codecov Bot commented Nov 18, 2025

Codecov Report

❌ Patch coverage is 77.77778% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.00%. Comparing base (097afd9) to head (7226ebc).
⚠️ Report is 32 commits behind head on main.

Files with missing lines Patch % Lines
packages/apply-release-plan/src/index.ts 66.66% 1 Missing ⚠️
packages/cli/src/commit/getCommitFunctions.ts 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1774      +/-   ##
==========================================
- Coverage   81.05%   81.00%   -0.06%     
==========================================
  Files          54       54              
  Lines        2265     2269       +4     
  Branches      684      681       -3     
==========================================
+ Hits         1836     1838       +2     
- Misses        424      426       +2     
  Partials        5        5              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@reabiliti
Copy link
Copy Markdown

@Andarist hi, would you take a look? Needs this changes to use custom changeset generator in esm libs

@Andarist Andarist added this pull request to the merge queue Feb 28, 2026
Merged via the queue into main with commit 667fe5a Feb 28, 2026
4 of 6 checks passed
@Andarist Andarist deleted the support-es-module branch February 28, 2026 08:31
@github-actions github-actions Bot mentioned this pull request Feb 24, 2026
nnecec pushed a commit to nnecec/changesets-docs that referenced this pull request Apr 16, 2026
* Support ESM for custom changelog and commit options

* Handle interop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] @changesets/cli running cjs file, even though the package is a module Changeset using its CJS files in a ESM repo

3 participants