Skip to content

fix(nextjs): Stop Turbopack loaders from loading the Sentry CLI - #24651

Merged
chargome merged 1 commit into
developfrom
fix/turbopack-loaders-sentry-cli
Sep 23, 2026
Merged

chargome merged 1 commit into
developfrom
fix/turbopack-loaders-sentry-cli

Conversation

@chargome

Copy link
Copy Markdown
Member

Our Turbopack loaders imported helpers from @sentry/bundler-plugins/core, which also loads the sentry CLI package. The loaders need only two small helpers, so this adds a separate internal entry point, @sentry/bundler-plugins/loader-utils, that exports just those and doesn't touch the CLI.

This came up because the Next.js 16 canary build with Turbopack fails: Turbopack follows the loaders' imports into the CLI package and tries to compile one of its TypeScript type files (index.d.cts) as code. That's a bug on the Next.js side, but the loaders shouldn't pull in the CLI in the first place.

Fixes #24650

The Turbopack loaders imported helpers from @sentry/bundler-plugins/core, which also
loads the sentry CLI package. Next.js canary follows the loaders' imports into that
package and fails compiling its index.d.cts type file as code.

Add an internal @sentry/bundler-plugins/loader-utils entry point that exports only
the two helpers the loaders need, and point the loaders at it.

Fixes #24650
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chargome chargome self-assigned this Sep 23, 2026
@chargome

Copy link
Copy Markdown
Member Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 2b116e5. Configure here.

@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Path Size % Change Change
@sentry/browser 29.23 kB - -
@sentry/browser - with treeshaking flags 27.5 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 27.4 kB - -
@sentry/browser (incl. Tracing) 51.16 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 51.17 kB - -
@sentry/browser (incl. Tracing, Profiling) 54.16 kB - -
@sentry/browser (incl. Tracing, Replay) 90.75 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 79.85 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 95.45 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 108.42 kB - -
@sentry/browser (incl. Feedback) 46.76 kB - -
@sentry/browser (incl. sendFeedback) 34.29 kB - -
@sentry/browser (incl. FeedbackAsync) 39.39 kB - -
@sentry/browser (incl. Metrics) 30.25 kB - -
@sentry/browser (incl. Logs) 30.5 kB - -
@sentry/browser (incl. Metrics & Logs) 31.17 kB - -
@sentry/react 30.98 kB - -
@sentry/react (incl. Tracing) 53.44 kB - -
@sentry/vue 36.72 kB - -
@sentry/vue (incl. Tracing) 53.69 kB - -
@sentry/svelte 29.25 kB - -
CDN Bundle 30.93 kB - -
CDN Bundle (incl. Tracing) 51.69 kB - -
CDN Bundle (incl. Logs, Metrics) 33.19 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 53.66 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 73.92 kB - -
CDN Bundle (incl. Tracing, Replay) 89.27 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 91.23 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 95.43 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 97.4 kB - -
CDN Bundle - uncompressed 91.4 kB - -
CDN Bundle (incl. Tracing) - uncompressed 153.76 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 97.97 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 159.72 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 227.54 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 273.5 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 279.43 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 287.2 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 293.13 kB - -
@sentry/nextjs (client) 55.78 kB - -
@sentry/sveltekit (client) 51.59 kB - -
@sentry/core/server 39.92 kB - -
@sentry/core/browser 13.63 kB - -
@sentry/node 133.88 kB +0.02% +15 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 82.4 kB - -
@sentry/node - without tracing 90.39 kB +0.01% +7 B 🔺
@sentry/node - without channel injection 112.42 kB +0.02% +21 B 🔺
@sentry/aws-serverless 98.71 kB +0.03% +21 B 🔺
@sentry/cloudflare (withSentry) - minified 206.38 kB - -
@sentry/cloudflare (withSentry) 513.49 kB - -

View base workflow run

@chargome
chargome marked this pull request as ready for review September 23, 2026 13:42
@chargome
chargome requested a review from a team as a code owner September 23, 2026 13:42
@chargome
chargome requested review from Lms24, mydea, nicohrubec and timfish and removed request for a team and mydea September 23, 2026 13:42
@chargome
chargome merged commit 7824c40 into develop Sep 23, 2026
231 checks passed
@chargome
chargome deleted the fix/turbopack-loaders-sentry-cli branch September 23, 2026 14:39
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.

Next.js canary build fails with Turbopack because our loaders load the Sentry CLI

2 participants