Split `node` export condition of `@sentry/nextjs` into `import`/`require`

オープン
#25,598 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
next.js, node.js, typescript, webpack

調査の方向性

Start by reading the package export conditions for @sentry/nextjs and the related changes in #25599 and #22791; the issue does not name source files or tests. The work is complete when Node ESM imports and bundlers select the ESM server build while default imports keep working, with the listed Next.js versions, bundlers, cacheComponents, custom server, and auto-instrumentation scenarios covered. The issue describes major-version behavior changes and several cross-cutting compatibility checks.

索引モデルが issue の本文から書いたものです。

説明

Bug Next.js Node.js
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.
  • cacheComponents prerendering rejects the crypto.randomUUID() call inside captureException.

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/nextjs and @sentry/node.
  • @sentry/node behaves differently as ESM (default integrations, auto-instrumentation differences) - see https://github.com/getsentry/sentry-javascript/pull/10928 (removes CJS-only integrations)
  • Mixed require/import can 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.

Refs #22791, https://github.com/getsentry/sentry-javascript/pull/25599

主要言語
TypeScript
スター
8.8k
フォーク
1.9k
平均マージ
1日 8時間
マージ済み PR(30日)
744

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

getsentry/sentry-javascript のほかの issue

getsentry/sentry-javascript の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。