1

In a project i use typescript to generate es6 for server side (node.js) and es5 for client side. I've got a tsconfig.json and a tsconfigclient.json. I've got two task in tasks.json to generate javascript :

{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "typescript",
            "tsconfig": "tsconfig.json",
            "problemMatcher": [
                "$tsc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        },
        {
            "type": "typescript",
            "tsconfig": "tsconfigclient.json",
            "problemMatcher": [
                "$tsc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}

Both could be run whith ctrl-shift-B ... but vscode ask me witch one to use ? Is it possible to launch both in same time with ctrl-shift-b

Thanks. PS : I'm begginer in node.js, typescript and vscode.

Matt Bierner
  • 58,117
  • 21
  • 175
  • 206
Yaume
  • 13
  • 3

1 Answers1

2

One option is to create a composite task that uses dependsOn to run the other two tasks:

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build1",
            "identifier": "build1",         
            "type": "typescript",
            "tsconfig": "tsconfig.json",
            "problemMatcher": [
                "$tsc"
            ],
            "group": "build"
        },
        {
            "label": "build2",
            "identifier": "build2",
            "type": "typescript",
            "tsconfig": "tsconfigclient.json",
            "problemMatcher": [
                "$tsc"
            ],
            "group": "build"
        },
        {
            "label": "Composite",
            "dependsOn": [
                "build1",
                "build2"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            }

        }
    ]
}

You can also use a command line task to run more than one command. This answer has more info about that

Matt Bierner
  • 58,117
  • 21
  • 175
  • 206
  • Hello, I've just changed "label" by "taskName" in group "Composite". And it works. Thanks a lot. – Yaume Nov 28 '17 at 19:41