Using “preLaunchTasks” and Naming a Task in Visual Studio Code

FWIW, I’m using VS Code 1.20.1 and here’s how I got my preLaunchTask to work:

In launch.json:

{
  "version": "0.2.0",
  "configurations": [
    {
        "type": "node",
        "request": "launch",
        ...
        "preLaunchTask": "npm: build",
    }
  ]
}

In my package.json:

{
  ...
  "scripts": {
     "build": "tsc"
     ...
  }
}

Leave a Comment