Skip to content

chore: remove redundant module field from package.json files - #7130

Merged
trentm merged 3 commits into
open-telemetry:mainfrom
embrace-io:overbalance/remove-module-field
Sep 28, 2026
Merged

trentm merged 3 commits into
open-telemetry:mainfrom
embrace-io:overbalance/remove-module-field

Conversation

@overbalance

@overbalance overbalance commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Removes the legacy module field from every package that already declares an exports map pointing at ./dist/index.mjs.

Bundlers that support exports (webpack 5+, Rollup, esbuild, Vite, Parcel 2) resolve through it and ignore module, so the field is dead weight. Webpack 4 is the main consumer that only reads module, and it is no longer supported.

main and types stay in place for tools that predate exports.

Tree-shaking test change

The API tree-shaking test imported from '../../'. Webpack applies the exports map only to bare package specifiers, so a relative directory import falls back to mainFields (browser, module, main). With module gone it resolved main (dist/index.cjs), which webpack cannot tree-shake, and every API landed in the bundle.

The test now imports from '@opentelemetry/api', which resolves through exports to dist/index.mjs. This is the same path real consumers take, so the test now checks what users actually get.

@overbalance
overbalance requested review from a team as code owners September 28, 2026 18:42
@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Merged · refreshed 2026-09-28 22:28 UTC

Status above doesn't look right?
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

@codecov

codecov Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.11%. Comparing base (acd385f) to head (e53b2ff).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7130   +/-   ##
=======================================
  Coverage   95.11%   95.11%           
=======================================
  Files         384      384           
  Lines       13476    13476           
  Branches     3095     3095           
=======================================
  Hits        12818    12818           
  Misses        658      658           
🚀 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.

@overbalance
overbalance marked this pull request as draft September 28, 2026 19:08
@overbalance
overbalance marked this pull request as ready for review September 28, 2026 19:22
@trentm
trentm added this pull request to the merge queue Sep 28, 2026
Merged via the queue into open-telemetry:main with commit 2f7189b Sep 28, 2026
26 checks passed
wolfgangcodes added a commit to wolfgangcodes/opentelemetry-js that referenced this pull request Oct 12, 2026
…fault condition

The exports map now uses the "require" and "default" conditions, as in open-telemetry#7132.
The package.json file also drops the "module" field, as in open-telemetry#7130.

Assisted-by: Claude Opus 5.5
Signed-off-by: Wolfgang Therrien <wolfgang@wolfgangcodes.com>
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