Skip to content

fix(nextjs): Only inject applicationKey metadata into browser bundles - #25565

Merged
logaretm merged 1 commit into
developfrom
awad/nextjs-application-key-client-only
Oct 20, 2026
Merged

logaretm merged 1 commit into
developfrom
awad/nextjs-application-key-client-only

Conversation

@logaretm

Copy link
Copy Markdown
Member

The applicationKey metadata snippet was also injected into every server and edge module, where nothing reads it and it slows cold starts, fixed by limiting it to browser modules in both the Turbopack rule and the webpack plugin options.

I updated the Turbopack rule tests for the browser condition and added a test that webpack server and edge builds no longer get the key.

closes #25544

The metadata snippet was injected into server and edge modules too, where nothing reads it, adding to every cold start.

Fixes #25544
@logaretm

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 23d3442. Configure here.

@logaretm
logaretm marked this pull request as ready for review October 20, 2026 15:03
@logaretm
logaretm requested a review from a team as a code owner October 20, 2026 15:03
@logaretm
logaretm requested review from chargome and s1gr1d and removed request for a team October 20, 2026 15:03
@linear-code

linear-code Bot commented Oct 20, 2026

Copy link
Copy Markdown

JS-3965

@logaretm
logaretm merged commit afb4282 into develop Oct 20, 2026
95 checks passed
@logaretm
logaretm deleted the awad/nextjs-application-key-client-only branch October 20, 2026 15:47
logaretm added a commit that referenced this pull request Oct 20, 2026
…dles (#25567)

Backport of: #25565

## Differences to the original PR

- `packages/nextjs/src/config/getBuildPluginOptions.ts`: the server/edge
`applicationKey` override is spread after
`webpack.unstable_sentryWebpackPluginOptions`, because v10 still spreads
those options last and our docs tell webpack users to set
`applicationKey` there. Added a test for that path.
- `constructTurbopackConfig.ts` and its test: kept v10's
`_experimental.turbopackApplicationKey` fallback and its test, which
`develop` no longer has.
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.

nextjs: Turbopack applicationKey rule also tags server modules, slowing cold starts

2 participants