Skip to content

Conversation

@logaretm
Copy link
Collaborator

@logaretm logaretm commented Dec 30, 2025

This fixes breakpoints for editors like VSCode/Cursor in server-side code.

I have verified that breakpoints work in:

  • Server-side app router components
  • Server-side pages router functions and static params
  • API endpoints and server-side functions
  • middleware

This only affects webpack, and doesn't change anything for prod builds.

closes #17088

@linear
Copy link

linear bot commented Dec 30, 2025

@github-actions
Copy link
Contributor

github-actions bot commented Dec 30, 2025

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 8,875 - 9,079 -2%
GET With Sentry 1,760 20% 1,730 +2%
GET With Sentry (error only) 6,095 69% 6,112 -0%
POST Baseline 1,204 - 1,170 +3%
POST With Sentry 602 50% 561 +7%
POST With Sentry (error only) 1,069 89% 1,032 +4%
MYSQL Baseline 3,329 - 3,198 +4%
MYSQL With Sentry 493 15% 400 +23%
MYSQL With Sentry (error only) 2,739 82% 2,584 +6%

View base workflow run

@logaretm logaretm marked this pull request as ready for review December 30, 2025 15:47
Copilot AI review requested due to automatic review settings December 30, 2025 15:47
@logaretm logaretm requested a review from chargome December 30, 2025 15:48
@logaretm logaretm changed the title fix(next): Ensure inline Sourcemaps are generated for wrapped modules in Dev fix(next): Ensure inline sourcemaps are generated for wrapped modules in Dev Dec 30, 2025
Copy link
Contributor

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 fixes debugger breakpoint support in development mode for Next.js server-side code by generating inline sourcemaps in the wrapping loader. The changes ensure that IDEs like VSCode and Cursor can correctly map breakpoints back to the original source files for server components, API routes, middleware, and other server-side code.

  • Adds isDev parameter to wrapping loader options and passes it through webpack configuration
  • Modifies sourcemap generation to use inline sourcemaps in dev mode and hidden sourcemaps in production
  • Implements absolute path preservation in dev mode sourcemaps to ensure correct breakpoint resolution
  • Adds test coverage for both dev and production sourcemap behavior

Reviewed changes

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

File Description
packages/nextjs/src/config/webpack.ts Adds isDev flag to staticWrappingLoaderOptions to pass development mode state to the wrapping loader
packages/nextjs/src/config/loaders/wrappingLoader.ts Implements inline sourcemap generation for dev mode, including logic to preserve absolute paths and create identity mappings when no sourcemap exists
packages/nextjs/test/config/wrappingLoader.test.ts Adds test coverage for inline sourcemap presence in dev mode and absence in production mode

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

@logaretm logaretm requested a review from Lms24 December 31, 2025 10:27
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.

Ensure debugging server-side code (app router) in VSCode works

2 participants