Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes an issue where debug IDs were being incorrectly injected into node_modules files when sourcemaps were explicitly disabled, causing compilation errors on subsequent builds. The fix adds a check to skip debug ID injection when sourcemaps.disable is set to true.
Changes:
- Added conditional check to prevent debug ID injection when sourcemaps are explicitly disabled in Next.js production builds
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| await sentryBuildPluginManager.createRelease(); | ||
|
|
||
| if (!usesNativeDebugIds) { | ||
| // Skip debug ID injection if sourcemaps are disabled which are only relevant for sourcemap correlation |
There was a problem hiding this comment.
The comment's grammar is ambiguous. The phrase "which are only relevant" makes it unclear whether it refers to "sourcemaps" or "debug IDs". Consider rephrasing for clarity.
| // Skip debug ID injection if sourcemaps are disabled which are only relevant for sourcemap correlation | |
| // Skip debug ID injection when sourcemaps are disabled, because debug IDs are only relevant for sourcemap correlation. |
|
|
||
| if (!usesNativeDebugIds) { | ||
| // Skip debug ID injection if sourcemaps are disabled which are only relevant for sourcemap correlation | ||
| if (!usesNativeDebugIds && sentryBuildOptions.sourcemaps?.disable !== true) { |
There was a problem hiding this comment.
Consider adding test coverage for the new conditional logic that skips debug ID injection when sourcemaps are disabled. The test should verify that injectDebugIds is not called when sentryBuildOptions.sourcemaps.disable is true, but is called when it's false or undefined. This would ensure the fix for issue #18983 remains working.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
This PR adds an additional check to make sure we only inject debug IDs if sourcemaps are NOT disabled. The issue isn't present when sourcemaps are enabled and since debug IDs are only relevant for sourcemap correlation then this should be a safe change AFAIK.
Closes #18983