Skip to content

Conversation

@clayroach
Copy link

@clayroach clayroach commented Jan 5, 2026

Problem

@effect/opentelemetry marks @opentelemetry/sdk-trace-node and @opentelemetry/sdk-trace-web as optional peer dependencies. However, both are exported from the main index.ts, which creates static ESM imports. This causes module resolution errors when users don't have these packages installed:

Error: Cannot find package '@opentelemetry/sdk-trace-web' imported from 
.../@effect/opentelemetry/dist/esm/WebSdk.js

Solution

Make @opentelemetry/sdk-trace-node and @opentelemetry/sdk-trace-web required peer dependencies by removing them from peerDependenciesMeta.

Changes

  • Removed optional: true for @opentelemetry/sdk-trace-node
  • Removed optional: true for @opentelemetry/sdk-trace-web

Testing

  • Build passes
  • All tests pass (15/15)

@changeset-bot
Copy link

changeset-bot bot commented Jan 5, 2026

🦋 Changeset detected

Latest commit: b713b28

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

This PR includes changesets to release 1 package
Name Type
@effect/opentelemetry Patch

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

@clayroach clayroach force-pushed the fix/opentelemetry-optional-peer-deps branch 2 times, most recently from ac92bde to 9fe789e Compare January 5, 2026 19:06
@clayroach clayroach changed the base branch from next-major to main January 5, 2026 19:06
@mikearnaldi
Copy link
Member

we should make them peer dependencies instead of optional, cc @tim-smart

…er deps

Remove optional flag from @opentelemetry/sdk-trace-node and
@opentelemetry/sdk-trace-web peer dependencies. This fixes module
resolution errors when importing from the main entry point, since
ESM static imports require these packages to be installed.
@clayroach clayroach force-pushed the fix/opentelemetry-optional-peer-deps branch from 9fe789e to b713b28 Compare January 6, 2026 00:15
@clayroach clayroach changed the title fix(opentelemetry): move NodeSdk and WebSdk to subpath exports fix(opentelemetry): make sdk-trace-node and sdk-trace-web required peer deps Jan 6, 2026
@clayroach
Copy link
Author

Done

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

Labels

None yet

Projects

Status: Discussion Ongoing

Development

Successfully merging this pull request may close these issues.

2 participants