'How Do I Set Task as preLaunchTask in .code-workspace?

I have a multi-root workspace with launch configurations and tasks. The tasks run fine on their own, but they don't run when added as a preLaunchTask. VS Code throws the error "Could not find the task".

oving them to a tasks.json file is not an option for me.

Here's the relevant information from my .code-worspace file

{
    "folders": [
        {
            "name": "App",
            "path": "app"
        },
        {
            "name": "API",
            "path": "api"
        },
    ],
    "settings": {},
    "launch": {
        "configurations": [
            {
                "name": "Launch App",
                "type": "chrome",
                "request": "launch",
                "preLaunchTask": "npm: start",
                "cwd": "${workspaceFolder:App}",
                "url": "http://localhost:3000",
                "webRoot": "${workspaceFolder:App}/src",
                "sourceMapPathOverrides": {
                  "webpack:///src/*": "${webRoot}/*"
                }
              }
        ]
    },
    "tasks": {
        "version": "2.0.0",
        "tasks": [
            {
                "type": "npm",
                "script": "start",
                "label": "npm: start",
                "detail": "react-scripts start",
                "options": {
                    "cwd": "${workspaceFolder:App}"
                },
                "problemMatcher": []
            }
        ]
    }
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source