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
{{ message }}
Repository navigation
Use package.json location to determine the default program root #326
I get bugs when using request: "pwa-node" but everything works ok when i use "debug.node.useV3": true in the settings.
Whats the difference, i thought both are using the new debugger?
That's interesting--usually we've seen the opposite 🙂
The process for launching a debug session is roughly:
Hit "start session"
VS Code asks the debug extension registered for the type to fill in the config--resolving defaults and such
VS Code takes the resolved config and starts a session
The existing debuggers are still registered for types like node and chrome. The useV3tells tells them that at step 2, instead of returning a config with the same debug type, return a config with the pwa- prefix to point to the new debugger. Step 2 doesn't happen again, so this means that defaults get filled in by the old debuggers instead of the logic in js-debug.
This has been the sources of a handful of bugs where we were expecting some new behavior that the old debugger didn't implement, or a new option that we didn't get a default for in step 3. But this is the first issue I've heard of pwa- failing and the non-prefixed one working! Can you describe the bugs are you running into?
ts-jest issue, Im running a test and setting a breakpoint.
When i use pwa-node it completely crashes (like, i have to restart VSCode).
But using the useV3 works ok.
Note: Using the "preview" debug extension
Verbose logs are written to:
/Users/[User]/Library/Application Support/Code/logs/20200211T172326/exthost1/ms-vscode.js-debug-nightly/vscode-debugadapter-0.json
/usr/local/bin/node ./node_modules/.bin/jest
Debugger listening on ws://127.0.0.1:65439/50bb7dcc-feb5-4a18-a800-fddfaf3dec4e
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
Thanks for the logs, I see some of why it's stopping in the code you've shared: it's a "pause" for us to parse a sourcemap, at which point the debugger just stops and doesn't continue. Are you able to share a link to the project you're working on so I can narrow down why it's not resuming? If not I can probably manage to get a reproduction, but it would make things easier :)
Both versions "Creating source from url" for every single node module, is there a way to skip anything inside of "node_modules" ?
Unfortunately not. Those sources are shown in the "Loaded Scripts" view on the side, and is information to create a stacktrace when paused, for example.
Unfortunately the problem doesn't happen when i break it out into a test case.
Edit: Now i know why, for some reason when i run it in the monorepo it starts parsing JS files from other folders within the larger project (i don't know why it's doing this), but when i extract just that folder out it works. I get a lot of no sourceRoot specified, using script dirname
Yeah this is weird, for no rhyme or reason its parsing source maps from other projects, i never reference these files anywhere.
Basically i get a load of
{"tag":"sourcemap.parsing","timestamp":1581510743199,"message":"no sourceRoot specified, using script dirname","metadata":{"absSourceRoot":"/Users/[User]/workspace/monorepo/DifferentProject/vendor/@dep/core/_bundles"},"level":0}
Ive noticed it only does it for folders that have .maps in them
Also... looking through the trace there are some internal files which won't exist, for e.g
{"tag":"runtime.sourcecreate","timestamp":1581507804406,"message":"Creating source from url","metadata":{"inputUrl":"internal/timers.js","absolutePath":"/Users/[User]/workspace/project/ui/internal/timers.js"},"level":0}
In the logs you sent it seems like this is working; I'm not seeing it parsing from a different folder and both the pwa-node and node logs contain about the same amount of sourcemap.parsing events.
no sourceRoot specified, using script dirname is expected for TS files running in Node, that's mostly diagnostic.
Hmm, the search paths for source maps is determined by the outFiles, which defaults to all JS files in your project excluding node_modules:
Thats interesting, I wasn't aware of that. So outFiles is using ${workspaceFolder} ?
I work in a monorepo and i have the whole repo set as my workspace, (I'm sure others work in this way too). So i should probably scope that down to the folder i care about for this launch task.
Is that a good default? I feel it's not obvious behaviour.
Could there be some sort of root property it uses instead? or using tsconfig.json/package.json as the root?.
I wouldn't know to set outFiles unless i have my sourcemaps in a very specific place, i wonder if there should be some documentation surrounding "outFiles" to explain this, at the very least the tooltip showing what the defaults are considering this is an easy trap to fall into if you use workspaces.
I will try changing "outFiles" to the ui folder and see if that changes anything and come back to you.
I'm not sure either. In fact there's a log line in the pwa-node version saying that prediction successfully completed after 5.5 seconds. Maybe the log shared originally was the wrong one?
I believe that outFiles defaulting to the entire workspace is a good default to most users. Alternatively, maybe it should default to the closest package.json relative to the debugged program? I believe Lerna et al. generally have package.json's in each submodule, so that could be a decent heuristic.
I believe that outFiles defaulting to the entire workspace is a good default to most users. Alternatively, maybe it should default to the closest package.json relative to the debugged program? I believe Lerna et al. generally have package.json's in each submodule, so that could be a decent heuristic.
Yeah, i think that should be a fine heuristic to go by.
Even if you decide not to do this, It's worth documenting the behaviour of "outFiles" anyway because i wouldn't have suspected it to work like that.
changed the title [-]Whats the difference between "pwa-node" and "debug.node.useV3": true [/-][+]Use package.json location to determine the default program root[/+]on Feb 18, 2020
Activity
connor4312 commentedon Feb 11, 2020
That's interesting--usually we've seen the opposite 🙂
The process for launching a debug session is roughly:
typeto fill in the config--resolving defaults and suchThe existing debuggers are still registered for types like
nodeandchrome. TheuseV3tells tells them that at step 2, instead of returning a config with the same debug type, return a config with thepwa-prefix to point to the new debugger. Step 2 doesn't happen again, so this means that defaults get filled in by the old debuggers instead of the logic in js-debug.This has been the sources of a handful of bugs where we were expecting some new behavior that the old debugger didn't implement, or a new option that we didn't get a default for in step 3. But this is the first issue I've heard of pwa- failing and the non-prefixed one working! Can you describe the bugs are you running into?
jasonwilliams commentedon Feb 11, 2020
ts-jestissue, Im running a test and setting a breakpoint.When i use
pwa-nodeit completely crashes (like, i have to restart VSCode).But using the useV3 works ok.
Im on VSCode Version: 1.42.0 Stable
Output
jasonwilliams commentedon Feb 11, 2020
Both versions "Creating source from url" for every single node module, is there a way to skip anything inside of "node_modules" ?
connor4312 commentedon Feb 11, 2020
Thanks for the logs, I see some of why it's stopping in the code you've shared: it's a "pause" for us to parse a sourcemap, at which point the debugger just stops and doesn't continue. Are you able to share a link to the project you're working on so I can narrow down why it's not resuming? If not I can probably manage to get a reproduction, but it would make things easier :)
Unfortunately not. Those sources are shown in the "Loaded Scripts" view on the side, and is information to create a stacktrace when paused, for example.
jasonwilliams commentedon Feb 12, 2020
Unfortunately the problem doesn't happen when i break it out into a test case.
Edit: Now i know why, for some reason when i run it in the monorepo it starts parsing JS files from other folders within the larger project (i don't know why it's doing this), but when i extract just that folder out it works. I get a lot of
no sourceRoot specified, using script dirnameYeah this is weird, for no rhyme or reason its parsing source maps from other projects, i never reference these files anywhere.
Basically i get a load of
Ive noticed it only does it for folders that have .maps in them
Also... looking through the trace there are some internal files which won't exist, for e.g
{"tag":"runtime.sourcecreate","timestamp":1581507804406,"message":"Creating source from url","metadata":{"inputUrl":"internal/timers.js","absolutePath":"/Users/[User]/workspace/project/ui/internal/timers.js"},"level":0}Should they be added to SkipFiles?
connor4312 commentedon Feb 12, 2020
Hmm, the search paths for source maps is determined by the
outFiles, which defaults to all JS files in your project excluding node_modules:In the logs you sent it seems like this is working; I'm not seeing it parsing from a different folder and both the
pwa-nodeandnodelogs contain about the same amount ofsourcemap.parsingevents.no sourceRoot specified, using script dirnameis expected for TS files running in Node, that's mostly diagnostic.jasonwilliams commentedon Feb 12, 2020
Thats interesting, I wasn't aware of that. So outFiles is using
${workspaceFolder}?I work in a monorepo and i have the whole repo set as my workspace, (I'm sure others work in this way too). So i should probably scope that down to the folder i care about for this launch task.
Is that a good default? I feel it's not obvious behaviour.
Could there be some sort of root property it uses instead? or using tsconfig.json/package.json as the root?.
I wouldn't know to set outFiles unless i have my sourcemaps in a very specific place, i wonder if there should be some documentation surrounding "outFiles" to explain this, at the very least the tooltip showing what the defaults are considering this is an easy trap to fall into if you use workspaces.
I will try changing "outFiles" to the ui folder and see if that changes anything and come back to you.
jasonwilliams commentedon Feb 12, 2020
Using "outFiles" fixes it, thanks.
I still don't know why the old configuration worked fine though 😆
connor4312 commentedon Feb 12, 2020
I'm not sure either. In fact there's a log line in the pwa-node version saying that prediction successfully completed after 5.5 seconds. Maybe the log shared originally was the wrong one?
I believe that outFiles defaulting to the entire workspace is a good default to most users. Alternatively, maybe it should default to the closest
package.jsonrelative to the debuggedprogram? I believe Lerna et al. generally have package.json's in each submodule, so that could be a decent heuristic.cc roblourens
jasonwilliams commentedon Feb 12, 2020
Yeah, i think that should be a fine heuristic to go by.
Even if you decide not to do this, It's worth documenting the behaviour of "outFiles" anyway because i wouldn't have suspected it to work like that.
[-]Whats the difference between "pwa-node" and "debug.node.useV3": true [/-][+]Use package.json location to determine the default program root[/+]feat: guess outfiles to be relative to the nearest package.json
feat: guess outfiles to be relative to the nearest package.json