-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(nextjs): added webpack treeshaking flags as config #18359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
feat(nextjs): added webpack treeshaking flags as config #18359
Conversation
size-limit report 📦
|
bf5a673 to
66aa19c
Compare
There was a problem hiding this 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
debugLogstodebugLoggingfor consistency - Added
tracing,excludeReplayIframe,excludeReplayShadowDOM, andexcludeReplayCompressionWorkertree-shaking options - Refactored webpack configuration to use a dedicated
setupTreeshakingFromConfigfunction 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.
03e070a to
e66a724
Compare
packages/nextjs/test/config/webpack/constructWebpackConfig.test.ts
Outdated
Show resolved
Hide resolved
packages/nextjs/test/config/webpack/constructWebpackConfig.test.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
e66a724 to
c8832af
Compare
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:
debugLogsoption todebugLoggingCloses #18417