WebStorm is breaking on "localhost/path/to/file.js" and not "C:\disk\path\to\file.js"

Some additional context: I am using WebStorm 2021.3.2 on Windows 10. I am using the built in JavaScript debugger, and when breakpoints are hit, a new file with a path of "localhost" opens and execution breaks, despite the breakpoints being set in the file on disk. This screenshot should demonstrate - the tab on the bottom is the same as the tab on top, except it is referring to a file on from the localhost webserver, and not my disk (C:\ drive):

 

0
9 comments

that's strange, have never seen such issues when using the built-in web server for files hosting. Do you use any kind of transpiling/beautifying/etc. or the code in runtime exactly matches the one on disk? Can you repeat the issue in a new project?

0

I just now realized I was using url "https://localhost:63341" - after switching to just "http://localhost:63341" the issue has not appeared again. What effect does using https and clicking thru the insecure site warning on a browser have over using http on localhost?

0

Not sure... It works for me (in 2021.3.2) when using https://localhost:63342 URL

0

Is there any diagnostic data I could collect and/or view that would help me determine what is going on? I am still observing this behavior, regardless of http/https prefix on localhost url.

0

Please enable js.debugger.wip.log in Registry (Help | Find action..., type Registry... to locate it) by setting it to path to some temporary file like /tmp/wip.json, recreate the issue and provide this log along with the idea.log (Help > Show Log in ...). Note that the debug log will be re-written on each debugger start, so it's important to copy the log right after reproducing the issue

Note: please don't paste logs content here, upload them to some file server and share a link

1

Ok thank you, Elena. Helpful as always! I will enable this today and post back later this week with any relevant findings.

0

I was able to reproduce the issue while the js debugger log was enabled. I wasn't really able to interpret anything in the file; I have uploaded it here to share:

https://1drv.ms/u/s!AptI9iioFTxo1Z4pL0RZNyGiiOKZEw?e=vvwcZE

This screenshot illustrates the exact files where the issue was observed. in "assets\...\analyze-functions.js" I have set a breakpoint. However, WebStorm opens up a file via the "localhost:63341\...\analyze-functions.js" web server link. Code execution stops at the same pace the breakpoint was placed in that file. I'm unsure if this is the intended behaviors according to a setting or configuration I may have, but it seems to be randomly occurring. I do not observe this behavior every time. Sometimes the breakpoint will be hit on the file in which it was placed, and sometimes the file is opened via the localhost link.

0

didn't find any notion of a script with this name in the log... But looks as if you have at least some of your source scripts bundled with webpack - is it true? This can be a sourcemaps issue then - it the debugger can't resolve the original script from sourcemaps, the runtime version will be opened instead

1

I am not using webpack or any other transpilers or preprocessors, and no code minification. I am observing this behavior in a static website, using the built in WebStorm "JavaScript Debug" Run/Debug configuration.

0

Please sign in to leave a comment.