Skip to content

fix(nextjs): Limit Turbopack orchestrion loader to instrumented packages - #24792

Merged
chargome merged 1 commit into
developfrom
fix/nextjs-turbopack-orchestrion-path-filter
Sep 28, 2026
Merged

chargome merged 1 commit into
developfrom
fix/nextjs-turbopack-orchestrion-path-filter

Conversation

@chargome

Copy link
Copy Markdown
Member

Turbopack runs webpack loaders in a separate process, once per matched file. Our orchestrion rule matched every server-side JS file, including all of node_modules. Large apps paid that cost for files the transform never touches. The reporter's build went from 2 minutes to a 45 minute Vercel timeout after upgrading to v11, where build-time instrumentation is on by default.

The rule now has a path condition that only matches files inside instrumented packages. It matches node_modules/<name>/ anywhere in the path, so hoisted, workspace, scoped and pnpm layouts all work. The loader already skipped every other file, so the set of transformed modules does not change. Next.js 16.0.0 already supports RegExp path conditions.

The webpack path is unchanged. Webpack runs loaders in process, so the broad rule is cheap there.

Fixes #24764

Turbopack runs webpack loaders out of process, one round trip per matched
file. The orchestrion rule matched every server-side JS module, including
all of node_modules, so large apps paid that cost for files the transform
never touches. Restrict the rule with a path condition built from the
instrumented package names.

Fixes #24764
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@chargome chargome self-assigned this Sep 28, 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 e2ac19f. Configure here.

@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 29.24 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.15 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 51.17 kB - -
@sentry/browser (incl. Tracing, Profiling) 54.18 kB - -
@sentry/browser (incl. Tracing, Replay) 90.76 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 79.86 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 95.46 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 108.41 kB - -
@sentry/browser (incl. Feedback) 46.76 kB - -
@sentry/browser (incl. sendFeedback) 34.3 kB - -
@sentry/browser (incl. FeedbackAsync) 39.41 kB - -
@sentry/browser (incl. Metrics) 30.25 kB - -
@sentry/browser (incl. Logs) 30.51 kB - -
@sentry/browser (incl. Metrics & Logs) 31.18 kB - -
@sentry/react 31 kB - -
@sentry/react (incl. Tracing) 53.45 kB - -
@sentry/vue 36.74 kB - -
@sentry/vue (incl. Tracing) 53.7 kB - -
@sentry/svelte 29.26 kB - -
CDN Bundle 30.93 kB - -
CDN Bundle (incl. Tracing) 51.69 kB - -
CDN Bundle (incl. Logs, Metrics) 33.2 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.28 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 91.25 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 95.45 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 97.42 kB - -
CDN Bundle - uncompressed 91.4 kB - -
CDN Bundle (incl. Tracing) - uncompressed 153.77 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 97.97 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 159.73 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.44 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.77 kB - -
@sentry/sveltekit (client) 51.59 kB - -
@sentry/core/server 39.95 kB - -
@sentry/core/browser 13.63 kB - -
@sentry/node 137.15 kB +0.02% +15 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 82.8 kB - -
@sentry/node - without tracing 90.81 kB +0.02% +15 B 🔺
@sentry/node - without channel injection 115.51 kB +0.01% +8 B 🔺
@sentry/aws-serverless 99.08 kB +0.01% +9 B 🔺
@sentry/cloudflare (withSentry) - minified 206.62 kB - -
@sentry/cloudflare (withSentry) 514.02 kB - -

View base workflow run

@chargome
chargome marked this pull request as ready for review September 28, 2026 10:38
@chargome
chargome requested a review from a team as a code owner September 28, 2026 10:39
@chargome
chargome requested review from nicohrubec and s1gr1d and removed request for a team September 28, 2026 10:39
@chargome
chargome requested a review from timfish September 28, 2026 10:39
@chargome
chargome merged commit 20dfe1b into develop Sep 28, 2026
160 of 162 checks passed
@chargome
chargome deleted the fix/nextjs-turbopack-orchestrion-path-filter branch September 28, 2026 10:48
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 v11 build-time instrumentation: Turbopack build timeout and opt-out trace coverage

3 participants