utkarsh tyagi
utkarsh tyagi

Reputation: 655

configuring tasks.json in visual code

Trying to configure tasks.json in such a way that it transpiles and runs the JS code. But not sure how to do that. Also, whenever I try to (Ctrl+Shift+B), VS code tells me:

No task is marked as a build task in tasks.json. Mark a task with 'isBuildCommand'

tasks.json:

{
    "version": "0.1.0",
    "command": "tsc",
    "isShellCommand": true,
    "showOutput": "silent", 
    "isBuildCommand": true,
    "args": ["--target", "ES5",
         "--outDir", "js",
         "--sourceMap",
         "--watch",
         "app.ts"],
    "problemMatcher": "$tsc"
}

Upvotes: 0

Views: 3069

Answers (2)

wkrueger
wkrueger

Reputation: 1353

Seems a bug.

Closing and reopening the window temporarily solved it.

https://github.com/Microsoft/vscode/issues/24796

Upvotes: 0

Sloven
Sloven

Reputation: 335

Looks like you miss the tasks array in your configuration. Here is an example from documentation

{
    "version": "0.1.0",
    "command": "echo",
    "isShellCommand": true,
    "args": [],
    "showOutput": "always",
    "echoCommand": true,
    "suppressTaskName": true,
    "tasks": [
        {
            "taskName": "hello",
            "args": ["Hello World"]
        },
        {
            "taskName": "bye",
            "args": ["Good Bye"]
        }
    ]
}

In your case, it might be something like.

{
    "version": "0.1.0",
    "command": "tsc",
    "isShellCommand": true,
    "tasks":[
        {
           "isBuildCommand": true,
           "args": ["--target", "ES5",
                    "--outDir", "js",
                    "--sourceMap",
                    "--watch",
                    "app.ts"],
           "problemMatcher": "$tsc",
           "showOutput": "silent"
        }
}

Upvotes: 2

Related Questions