You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently debugging why breakpoints in vscode are not found with our testing setup over at Preact. For that each test file is a fully self-contained bundle and our test runner serves those files relative to the server's process root:
Now onto the source map resolution. The spec has this to say about resolution:
If the sources are not absolute URLs after prepending of the “sourceRoot”, the sources are resolved relative to the SourceMap (like resolving script src in a html document).
The source maps generated by esbuild look like this for me:
This leads to duplicate path segments as above. Here is a screenshot of what it looks like in Chrome's Devtools in Preact's suite:
In the screenshot compat/test/browser is repeated twice. So when a user creates a breakpoint in vscode the requested paths don't match and therefore the breakpoint is not found.
The way webpack handles this is by using a custom protocol webpack:// to force the resolution logic to always be absolute. The vscode debugger plugin has some built-in mappings that map this to the projects working directory.
I don't think using something like esbuild:// would be a good fit, but some form of absolute resolution is needed for a consistent experience. Maybe this can be done via sourceRoot by setting it to a value which can be easily mapped by debuggers.
The text was updated successfully, but these errors were encountered:
Can you try manually adding the appropriate sourceRoot value to the source map yourself and confirming that this fixes the issue for you locally? It would be good to know if that is a valid fix for this issue or not.
I'm currently debugging why breakpoints in vscode are not found with our testing setup over at Preact. For that each test file is a fully self-contained bundle and our test runner serves those files relative to the server's process root:
How the files are served by the test runner:
Now onto the source map resolution. The spec has this to say about resolution:
The source maps generated by esbuild look like this for me:
They don't have a
sourceRoot
property and therefore the source maps are resolved relative to the js file.This leads to duplicate path segments as above. Here is a screenshot of what it looks like in Chrome's Devtools in Preact's suite:
In the screenshot
compat/test/browser
is repeated twice. So when a user creates a breakpoint in vscode the requested paths don't match and therefore the breakpoint is not found.The way webpack handles this is by using a custom protocol
webpack://
to force the resolution logic to always be absolute. The vscode debugger plugin has some built-in mappings that map this to the projects working directory.I don't think using something like
esbuild://
would be a good fit, but some form of absolute resolution is needed for a consistent experience. Maybe this can be done viasourceRoot
by setting it to a value which can be easily mapped by debuggers.The text was updated successfully, but these errors were encountered: