Skip to content

Conversation

@logaretm
Copy link
Collaborator

@logaretm logaretm commented Dec 1, 2025

This PR updates the Sentry Next.js integration to improve tree-shaking configuration and add new options for finer control over what SDK code is included in the final bundle.

The most significant changes are:

  • Renaming of the debugLogs option to debugLogging
  • Added several new tree-shaking flags for better user DX.

Closes #18417

@linear
Copy link

linear bot commented Dec 1, 2025

@logaretm logaretm requested a review from chargome December 1, 2025 16:01
@github-actions
Copy link
Contributor

github-actions bot commented Dec 1, 2025

size-limit report 📦

Path Size % Change Change
@sentry/browser 24.8 kB - -
@sentry/browser - with treeshaking flags 23.31 kB - -
@sentry/browser (incl. Tracing) 41.54 kB - -
@sentry/browser (incl. Tracing, Profiling) 46.13 kB - -
@sentry/browser (incl. Tracing, Replay) 79.96 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 69.69 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 84.64 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 96.88 kB - -
@sentry/browser (incl. Feedback) 41.48 kB - -
@sentry/browser (incl. sendFeedback) 29.49 kB - -
@sentry/browser (incl. FeedbackAsync) 34.47 kB - -
@sentry/react 26.52 kB - -
@sentry/react (incl. Tracing) 43.74 kB - -
@sentry/vue 29.25 kB - -
@sentry/vue (incl. Tracing) 43.34 kB - -
@sentry/svelte 24.82 kB - -
CDN Bundle 27.21 kB - -
CDN Bundle (incl. Tracing) 42.21 kB - -
CDN Bundle (incl. Tracing, Replay) 78.75 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 84.2 kB - -
CDN Bundle - uncompressed 79.96 kB - -
CDN Bundle (incl. Tracing) - uncompressed 125.34 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 241.37 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 254.13 kB - -
@sentry/nextjs (client) 45.96 kB - -
@sentry/sveltekit (client) 41.9 kB - -
@sentry/node-core 51.27 kB -0.01% -1 B 🔽
@sentry/node 159.53 kB - -
@sentry/node - without tracing 92.85 kB +0.01% +1 B 🔺
@sentry/aws-serverless 108.14 kB - -

View base workflow run

@logaretm logaretm force-pushed the awad/js-1222-add-treeshaking-options-for-webpack branch 2 times, most recently from bf5a673 to 66aa19c Compare December 4, 2025 14:44
Copilot AI review requested due to automatic review settings December 4, 2025 14:44
Copilot finished reviewing on behalf of logaretm December 4, 2025 14:47
Copy link

Copilot AI left a comment

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 enhances the Sentry Next.js SDK's tree-shaking capabilities by renaming debugLogs to debugLogging and introducing four new configuration options for fine-grained control over SDK bundle inclusion.

Key Changes:

  • Renamed configuration option from debugLogs to debugLogging for consistency
  • Added tracing, excludeReplayIframe, excludeReplayShadowDOM, and excludeReplayCompressionWorker tree-shaking options
  • Refactored webpack configuration to use a dedicated setupTreeshakingFromConfig function for improved maintainability

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 9 comments.

File Description
packages/nextjs/src/config/types.ts Added type definitions and JSDoc documentation for four new tree-shaking options
packages/nextjs/src/config/webpack.ts Extracted tree-shaking setup into a dedicated function that handles all five tree-shaking flags via webpack DefinePlugin
packages/nextjs/test/config/fixtures.ts Updated DefinePlugin mock to accept and store definitions for test verification
packages/nextjs/test/config/webpack/constructWebpackConfig.test.ts Added comprehensive test suite covering all tree-shaking options across different build contexts (server, client, edge)

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

@logaretm logaretm force-pushed the awad/js-1222-add-treeshaking-options-for-webpack branch from 03e070a to e66a724 Compare December 5, 2025 09:56
Base automatically changed from awad/js-1111-deprecate-top-level-webpack-options to develop December 5, 2025 15:21
@logaretm logaretm force-pushed the awad/js-1222-add-treeshaking-options-for-webpack branch from e66a724 to c8832af Compare December 5, 2025 15:23
@logaretm logaretm linked an issue Dec 5, 2025 that may be closed by this pull request
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.

feat(nextjs): added webpack treeshaking flags as config Add treeshaking option for webpack

2 participants