vscode
vscode copied to clipboard
Tasks running same npm script in other cwd are ignored and "don't exist"
Does this issue occur when all extensions are disabled?: Yes
- VS Code Version: 1.86.2
- OS Version: Windows_NT x64 10.0.22631
Steps to Reproduce:
- Use the following
tasks.json:
{
"version": "2.0.0",
"tasks": [
{
"label": "service.a",
"options": {"cwd": "${workspaceFolder}/packages/service.a"},
"script": "example",
"type": "npm"
},
{
"label": "service.b",
"options": {"cwd": "${workspaceFolder}/packages/service.b"},
"script": "example",
"type": "npm"
}
]
}
- Try running
service.atask. It won't exist.
Expected behavior:
I expect both tasks to exist and be able to get launched. It seems that service.b overwrites service.a because both run example script, but the task manager doesn't seem to understand that the options are different (different cwd). To work around this, I need to name scripts different, which causes issues for a monorepo structure.
If you want to run both tasks simultaneously, you can create a new task that runs both tasks in parallel. Here's an example of how you can do this:
{ "version": "2.0.0", "tasks": [ { "label": "service.a", "options": {"cwd": "${workspaceFolder}/packages/service.a"}, "script": "example", "type": "npm" }, { "label": "service.b", "options": {"cwd": "${workspaceFolder}/packages/service.b"}, "script": "example", "type": "npm" }, { "label": "service.a and service.b", "dependsOn": ["service.a", "service.b"], "type": "parallel" } ] }
If you want to run both tasks simultaneously, you can create a new task that runs both tasks in parallel. Here's an example of how you can do this:
That is not what this bug report is about. Besides that, your snippet doesn't even work. The bug still exists, making service.a non-existent, and type = parallel doesn't exist either.
/duplicate #93001