-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] How to launch a debugger #558
Comments
That's an interesting question - I think Node currently has a quirk that prevents us from supporting I think a fix would be to submit a PR to Node to do something like this. It will work because if the resolution fails then it's proof enough that we're not executing the main entry point anyway, and as soon as the resolution becomes available we get the correct result. if (!resolvedArgv) {
// We enter the repl if we're not given a filename argument.
if (process.argv[1]) {
try {
resolvedArgv = Module._resolveFilename(process.argv[1], null, false);
} catch {}
} else {
resolvedArgv = 'repl';
}
}
if (resolvedArgv) {
// ...
} |
That is interesting. I attempted to start webpack-dev-server directly through node without the Does yarn add the Changing The script to this:
or
does not work. Looking through the |
The Note that the best command line would be
What's the exact output? |
|
I think it's because you have an extra dot: should be |
Yes. Good eye but the path ended up being more complex:
I am not sure how
I have confirmed that the above doesn't work with the |
Should be fixed with my pr nodejs/node#30336, which I think shipped in Node 13.4 |
I was able to get debugging with Leaving these here for other people that might come across this Using Using {
"type": "node",
"request": "launch",
"name": "Debug index",
"skipFiles": ["<node_internals>/**", "node_modules/**"],
"runtimeArgs": ["-r", "./.pnp.js", "-r", "ts-node/register"],
"args": ["${workspaceFolder}/src/index.ts"],
"cwd": "${workspaceFolder}"
} |
I don't manage to launch a debug session with VSCode with the follwing {
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "debug tests",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "yarn",
"port": 9229,
"runtimeArgs": ["run", "--inspect-brk", "test"],
"stopOnEntry": true
},
]
} VSCode cannot connect to the debug port. Is there anything I am doing wrong? |
I tested monorepo with pnp.js and zero-installs. Packages under .yarn/cache. I am using globally installed jest though, not sure how to use local one.
|
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch via Yarn",
"request": "launch",
"runtimeArgs": [
"jest",
"--config",
"${workspaceFolder}/packages/service/jest.config.js"
],
"runtimeExecutable": "yarn",
"cwd": "${workspaceFolder}/packages/service",
"skipFiles": ["<node_internals>/**", "node_modules/**"],
"type": "pwa-node"
},
]
} |
this worked for me (used with |
How does one launch a debugger when using Yarn PNP.
Part of the issue may be:
However, I am having trouble understanding how to start a debugger with a pnp project. As node doesn't have support for yarn pnp, this did not work:
.vscode/launch.json
package.json
I didn't expect the above to work, as node doesn't understand yarn pnp, but that is where the test project is now.
Perhaps this hasn't yet been implemented, but I would like to debug my package to get it working in Yarn PNP.
The text was updated successfully, but these errors were encountered: