Skip to content

chore: Hoist transitive imports for bundles#21858

Merged
JPeer264 merged 1 commit into
developfrom
jp/transitive-import
Jun 30, 2026
Merged

chore: Hoist transitive imports for bundles#21858
JPeer264 merged 1 commit into
developfrom
jp/transitive-import

Conversation

@JPeer264

@JPeer264 JPeer264 commented Jun 30, 2026

Copy link
Copy Markdown
Member

Background

same as with #21856 I came across this with adding the Prisma integration to Cloudflare.

Screenshot 2026-06-30 at 11 23 57

What has changed

The @sentry/opentelemetry SDK has some side effect imports, which don't do anything: https://unpkg.com/@sentry/opentelemetry@10.62.0/build/esm/index.js

those are the imports

import '@sentry/conventions/attributes';
import '@opentelemetry/core';
import '@opentelemetry/sdk-trace-base';

hoistTransitiveImports has been added to get rid of the side effect imports. However, I'm confused with this option, as the docs say that this option is actually ignored when preserveModules have been set (but it still has an effect).

Also here, if someone has a better idea - I'm all ears.

@JPeer264 JPeer264 requested review from a team, Lms24 and timfish June 30, 2026 09:30
@JPeer264 JPeer264 self-assigned this Jun 30, 2026
@JPeer264 JPeer264 requested review from andreiborza and mydea and removed request for a team June 30, 2026 09:30
@mydea

mydea commented Jun 30, 2026

Copy link
Copy Markdown
Member

I think we should find out, why do we have this imports at all?? Like, this:

import '@sentry/conventions/attributes';
import '@opentelemetry/core';
import '@opentelemetry/sdk-trace-base';

seems like it should def. not be in the bundle there at all!!

@mydea

mydea commented Jun 30, 2026

Copy link
Copy Markdown
Member

seems we can't really get rid of this without splitting our builds into separate builds, which also seems unnecessary. this seems easy enough!

@JPeer264 JPeer264 merged commit 00e3ebb into develop Jun 30, 2026
561 of 563 checks passed
@JPeer264 JPeer264 deleted the jp/transitive-import branch June 30, 2026 13:31
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.

4 participants