Skip to content

feat(nextjs): Deprecate Webpack top-level options - #18343

Merged
logaretm merged 11 commits into
developfrom
awad/js-1111-deprecate-top-level-webpack-options
Dec 5, 2025
Merged

feat(nextjs): Deprecate Webpack top-level options#18343
logaretm merged 11 commits into
developfrom
awad/js-1111-deprecate-top-level-webpack-options

Conversation

@logaretm

Copy link
Copy Markdown
Member

This PR deprecates the webpack-only configurations via the @deprecated JSDoc annotation and introduces a new webpack config namespace for them.

Under the hood the logic was changed to read from the new values, with a compatibility layer that sets them from the deprecated top-level options while warning for each option if used.

This should set us up for a v11/v12 deletion of those options.

I might have missed a few options that only affect webpack, so I appreciate a good look at this. At any case this isn't breaking so even if missed a few, users won't experience disruptions.

@linear

linear Bot commented Nov 27, 2025

Copy link
Copy Markdown

@RulaKhaled RulaKhaled left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Generally looks good to me, but i'll recommend waiting for @charly's review!

@logaretm
logaretm force-pushed the awad/js-1111-deprecate-top-level-webpack-options branch from beb7c72 to 9ef882c Compare December 1, 2025 15:32

@chargome chargome left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good already, let's make sure to have a docs pr in place that we can deploy immediately when this is released otherwise users will have a conflict between docs|sdk

Comment thread packages/nextjs/src/config/types.ts Outdated

@chargome chargome left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just blocking this for widenClientFileUpload so this does not get merged accidentally

@logaretm
logaretm requested a review from chargome December 2, 2025 13:40
@github-actions

github-actions Bot commented Dec 2, 2025

Copy link
Copy Markdown
Contributor

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.

Scenario Requests/s % of Baseline Prev. Requests/s Change %
GET Baseline 9,358 - 9,024 +4%
GET With Sentry 1,750 19% 1,691 +3%
GET With Sentry (error only) 5,945 64% 6,133 -3%
POST Baseline 1,126 - 1,201 -6%
POST With Sentry 570 51% 582 -2%
POST With Sentry (error only) 997 89% 1,051 -5%
MYSQL Baseline 3,298 - 3,304 -0%
MYSQL With Sentry 476 14% 460 +3%
MYSQL With Sentry (error only) 2,677 81% 2,684 -0%

View base workflow run

Copilot AI review requested due to automatic review settings December 4, 2025 14:41
@logaretm

logaretm commented Dec 4, 2025

Copy link
Copy Markdown
Member Author

@chargome I got a companion docs PR ready as well for this

getsentry/sentry-docs#15691

so this should be ready to go if you think so.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR deprecates webpack-specific configuration options at the top level of Sentry build options and introduces a new webpack namespace to better organize these settings. The change is non-breaking due to a comprehensive backward compatibility layer that migrates deprecated options while emitting deprecation warnings.

  • Adds a new SentryBuildWebpackOptions type containing all webpack-specific configuration
  • Implements automatic migration from deprecated top-level options to the new webpack.* path
  • Updates all internal references to use the new namespaced configuration
  • Maintains full backward compatibility with deprecation warnings for future removal

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/nextjs/src/config/types.ts Defines new SentryBuildWebpackOptions type and adds @deprecated annotations to top-level webpack options; introduces new webpack property on SentryBuildOptions
packages/nextjs/src/config/withSentryConfig.ts Implements migrateDeprecatedWebpackOptions() function to handle backward compatibility and emit deprecation warnings; updates webpack config construction to use new namespaced options
packages/nextjs/src/config/webpack.ts Updates all references from top-level options to webpack.* namespaced options
packages/nextjs/src/config/getBuildPluginOptions.ts Updates plugin option extraction to read from webpack.* namespace
packages/nextjs/test/config/withSentryConfig.test.ts Adds comprehensive test coverage for migration logic, precedence rules, and deprecation warnings
packages/nextjs/test/config/getBuildPluginOptions.test.ts Updates existing tests to use new webpack.* namespaced options

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/nextjs/src/config/types.ts Outdated
Comment thread packages/nextjs/src/config/types.ts Outdated
*/
treeshake?: {
/**
* Tree shakes Sentry SDK logger statements from the bundle. Note that this doesn't affect Sentry Logs.

Copilot AI Dec 4, 2025

Copy link

Choose a reason for hiding this comment

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

The documentation should be more explicit about what setting this option to true does. Consider updating it to:

/**
 * When set to `true`, tree shakes Sentry SDK logger statements from the bundle, reducing bundle size.
 * Note that this doesn't affect Sentry Logs.
 * Defaults to `false`.
 */
debugLogging?: boolean;

This makes it clear that setting it to true enables the tree-shaking (removal) behavior.

Suggested change
* Tree shakes Sentry SDK logger statements from the bundle. Note that this doesn't affect Sentry Logs.
* When set to `true`, tree shakes Sentry SDK logger statements from the bundle, reducing bundle size.
* Note that this doesn't affect Sentry Logs.
* Defaults to `false`.

Copilot uses AI. Check for mistakes.

@chargome chargome left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good, just double checking: did you test this out locally and confirmed the webpack options get set correctly? We can't break existing setups with this one

@logaretm

logaretm commented Dec 5, 2025

Copy link
Copy Markdown
Member Author

Yep, I tested every option and made sure they are set correctly during build, will just fix a quick comment and merge.

@logaretm
logaretm merged commit 6e539e0 into develop Dec 5, 2025
401 of 403 checks passed
@logaretm
logaretm deleted the awad/js-1111-deprecate-top-level-webpack-options branch December 5, 2025 15:21
logaretm added a commit to getsentry/sentry-docs that referenced this pull request Dec 11, 2025
…5691)

We are moving the only-webpack related configurations under `webpack`
namespace to better fit our goal of communicating the SDK readiness for
Turbopack by default.

This involved moving several options to be nested under a `webpack` path
in the build configuration.

This is meant to be released once this
getsentry/sentry-javascript#18343 goes live, so
I will keep this open until then. Will keep it in draft as well.

The SDK PR adds warnings for those deprecated options and warns users
about using them if detected so I don't think we need to do that here
once it goes live.

---------

Co-authored-by: Sarah Mischinger <sarah@codingwriter.com>
chargome added a commit that referenced this pull request Aug 10, 2026
Removes the deprecated top-level `withSentryConfig` options marked with
`TODO(v11)`. All have replacements documented as an old→new table in
`docs/migration/v11-end-state.md`.

Also removes top-level `excludeServerRoutes`, which was deprecated in
the same PR as the others (#18343) but never
got a `TODO(v11)` marker.

closes #22245

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
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.

4 participants