Cannot get URLs to map via sourceURL= to local files (same files map in Chrome DevTools)
See original GitHub issueI initially filed this under “Other” because I didn’t have a great test case, but I have subsequently created one – see below.
I can’t get URLs executed via eval()
ed source code that uses //# sourceURL=[url]
to specify the source location to map to local files when developing.
I’ve created a GitHub gist to illustrate.
Steps to reproduce:
- Clone the gist into a directory.
- Start a server that serves that directory.
- Copy
launch.json
to.vscode/launch.json
(sorry, gists cannot contain directories) - Open VSCode to that directory
- Start a Chrome instance with the debugger on port 9222
Test case 1: Open browser to [server]/index.html
This will cause the sourceURL
"eval.js"
to be used for the evaluated eval.js
script.
Note that the script.js
script maps correctly, but that VSCode will not map the eval.js
script to the local eval.js
(Chrome DevTools will, if you mount the directory in the Filesystems tab.)
Test case 2: Open browser to [server]/index.html?full
This will cause the sourceURL
"[server]/eval.js"
to be used for the evaluated eval.js
script.
Note that VSCode will not map the script to the local eval.js
(Chrome DevTools will, if you mount the directory in the Filesystems tab.)
Should this work? Or am I on the wrong path?
Issue Analytics
- State:
- Created 3 years ago
- Comments:14 (5 by maintainers)
Top GitHub Comments
Fascinating, I was trying to debug in VSCode, couldn’t get my breakpoints to be hit, searched the issue database, saw this issue that looked like it might be relevant, opened it, and:
Glad the internet has a better memory than I do!
Just to be super-clear, though, in my case they’d be unbound at the beginning, then I could hit a
debugger
statement and bind them, and they’d remain bound until I refreshed (i.e., reloaded the page, or restarted from the debugger), when I could (in real time) watch them become unbound again. Don’t know if that’s helpful.