Skip to content

fix: export field order prefer esm #6005

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

Merged
merged 1 commit into from
Jul 12, 2025

Conversation

DylanPiercey
Copy link
Contributor

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes (bugfixes and features will not be merged without tests)
  • no

I'm not totally clear on how I would approach testing this 😓.

Breaking Changes?

  • yes (breaking changes will not be merged unless absolutely necessary)
  • no

List any relevant issue numbers:

Description

The way the exports field is configured in the package.json's cause the commonjs version of the package to always be used in environments that pass in both a require and import condition (most bundled envs).

This is because the way export conditions are matched is in the object order it checks each condition to see if it was provided. In this case since require is earlier in the list it is always preferred.

Copy link

vercel bot commented Jul 7, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
rollup ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 7, 2025 4:27pm

Copy link
Member

@lukastaegert lukastaegert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

@lukastaegert lukastaegert enabled auto-merge July 12, 2025 04:29
Copy link

codecov bot commented Jul 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.79%. Comparing base (9cebb0b) to head (ff39ab2).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6005   +/-   ##
=======================================
  Coverage   98.79%   98.79%           
=======================================
  Files         270      270           
  Lines       10559    10559           
  Branches     2815     2815           
=======================================
  Hits        10432    10432           
  Misses         87       87           
  Partials       40       40           

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

@lukastaegert lukastaegert added this pull request to the merge queue Jul 12, 2025
Merged via the queue into rollup:master with commit 1923218 Jul 12, 2025
41 checks passed
Copy link

This PR has been released as part of rollup@4.45.0. You can test it via npm install rollup.

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.

2 participants