Split node export condition of @sentry/nextjs into import/require #25598
Copy link
Copy link
Open
Description
Description
exports["."].node points to the CJS build, so Node ESM imports and bundlers that build the Next.js server never get the ESM server build.
Blockers (from #23628):
- 87 browser-only names are missing from the ESM server build.
cacheComponentsprerendering rejects thecrypto.randomUUID()call insidecaptureException.
Keep ESM default imports (import Sentry from '@sentry/nextjs') working with a default export in the ESM server build.
Not breaking by itself, but reasons to ship it in a major (planned v12):
- Every Next.js server bundle switches to the ESM builds of
@sentry/nextjsand@sentry/node. @sentry/nodebehaves differently as ESM (default integrations, auto-instrumentation differences) - see feat(node): Make ESM output valid Node ESM #10928 (removes CJS-only integrations)- Mixed
require/importcan load two SDK copies in one process - Bundlers check named imports at build time, so names that are missing from the ESM build become build errors
When testing, cover webpack and Turbopack on all supported Next.js versions, cacheComponents, a custom server, and check that auto-instrumentation spans (e.g. http, DB) still show up.
@sentry/remix pins node to CJS the same way.
Reactions are currently unavailable
Activity
linear-code commentedon Oct 21, 2026
JS-3978
fix(build): Make CJS re-exports visible to Node ESM imports (#25599)