Conversation

mischnic

This makes bundlers prefer the ESM version of index.server.js, for better tree shaking.

The ESM versions are already listed first for the edge versions

@Lms24Lms24 changed the title Prefer esm/index.server.js over CJS version ref(nextjs): Prefer esm/index.server.js over CJS version Apr 28, 2025
@Lms24

Hey @mischnic thanks for opening this PR!

To assess priority: Is the current exports declaration blocking you in some way? Could you elaborate a bit more what the specific issue is that this PR solves? Thanks!

I started our CI so that we check if our NextJS E2E tests are still passing. Unfortunately, exports changes are always a bit risky.

Also gonna ask @chargome to review

@Lms24Lms24 requested a review from chargome April 28, 2025 12:52
@mischnic

Sorry for the short description, this is the fix for #16121 as with this change, importing @sentry/nextjs in a Node.js context resolves to an ESM file and bundlers including Turbopack are able to treeshake away everything except the required export (before, this import lead to withSentryConfig to be included in the user's project).

@mydeamydea changed the base branch from master to develop May 14, 2025 14:22
Sign up for free to join this conversation on . Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.