next.js
49070443 - Add source map support for server components/actions in the browser (#71042)

Commit
1 year ago
Add source map support for server components/actions in the browser (#71042) This PR adds support for showing the original server sources of server components and server actions in the browser's developer tools. To accomplish that, we're building on top of #69190, #70563, and #70564, in which we prepared the proper generation of the source maps. This PR completes the feature, by wiring up `findSourceMapURL` (see https://github.com/facebook/react/pull/30741) with a new dev server middleware that serves those source map files to the browser. Another change we had to make is disabling the dead-code elimination of server actions in client bundles (see #70103), but only in development mode. This optimization is primarily intended for production bundles, so the change should not pose a problem. With that, it's now possible to jump directly into the server sources from the browser's dev tools, e.g. for component stacks of server logs that are replayed in the browser, or when inspecting server action props in the React DevTools.
Author
Parents
Loading