microsoft / vscode-js-debug

A DAP-compatible JavaScript debugger. Used in VS Code, VS, + more
MIT License
1.67k stars 282 forks source link

Add Turbopack sourcemap alias #1996

Closed timneutkens closed 7 months ago

timneutkens commented 7 months ago

What?

We got an issue report on the Next.js repository about the vscode debugger not automatically working with Turbopack enabled: https://github.com/vercel/next.js/issues/63740.

Turbopack (website) is the new bundler we've been building, it supports sourcemaps by default and works really well with VS Code's debugger but requires additional configuration compared to using Next.js with webpack because the debugger has built-in handling of webpack paths like webpack://.

This PR aims to support Turbopack paths in the same way.

On the Turbopack side we have this open PR to add turbopack:// to the sourcemaps: https://github.com/vercel/next.js/pull/64965

How?

Updated the sourceMapPathOverrides default to include the required path mapping for Turbopack. Similar to how Webpack and Meteor are handled there.

Open questions

Since I'm not familiar with this repository I could use some helping getting this over the line if it's not already good to land.

Specifically what's potentially missing is a test and the docs still need to be updated. It seems OPTIONS.md is auto-generated, should I run the script to generate it?

Thanks in advance!

avianion commented 7 months ago

@Tyriar @rzhao271 Please merge this, it's a small change but very useful for Turbopack and nextjs users.

connor4312 commented 7 months ago

Please run npm run fmt and then npm run watch to get the file formatted and OPTIONS.md updated. Thanks!

Tyriar commented 7 months ago

@avianion pinging random people isn't necessary

avianion commented 7 months ago

@Tyriar ok bro

Tyriar commented 7 months ago

@avianion thanks bro

timneutkens commented 7 months ago

Thanks @connor4312 💯 Very helpful!

connor4312 commented 7 months ago

no problem, this will be out in the VS Code release next week

timneutkens commented 7 months ago

Awesome, thank you!