You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
nextjs: Turbopack applicationKey rule also tags server modules, slowing cold starts #25544
Set applicationKey in withSentryConfig on a Next 16 app that builds with Turbopack.
Run next build.
Search the output for _sentryBundlerPluginAppKey:my-app in .next/static and in .next/server.
Start next start and time the first request to a route on a fresh process.
Expected Result
Only browser modules carry the metadata snippet. thirdPartyErrorFilterIntegration only runs in the browser, and @sentry/node does not export it, so nothing on the server reads the tags.
Actual Result
constructTurbopackConfig adds a *.{ts,tsx,js,jsx,mjs,cjs} rule whose only condition is { not: { path: /next\/dist\/build\/polyfills/ } }. Turbopack applies it to server and edge modules too. Each snippet evaluates new Error().stack twice when its module loads, so every cold start pays for it.
In our app:
Default rule
Same rule with a "browser" condition
Snippets in server output
15,353
5
Snippets in browser output
4,840
4,840
Cold first request, next start on a laptop, median of 7 (three routes)
757 / 816 / 829 ms
650 / 697 / 786 ms
Cold first request, Vercel preview (1 vCPU)
~2.7 s
~2.15 s
On Vercel's slower CPU the snippets cost 0.4 to 0.5 s per cold start.
We ran exactly this as our own turbopack.rules entry pointing at build/cjs/config/loaders/moduleMetadataInjectionLoader.js. The browser output was unchanged.
Activity
linear-code commentedon Oct 19, 2026
JS-3965
logaretm commentedon Oct 20, 2026
Thanks for the report, I got a PR out for it.
fix(nextjs): Only inject applicationKey metadata into browser bundles (…