Building tasks for coding

During the development process, we may repeat a lot of processes that we could automate or at least group them into tasks to help ourselves out. This section is going to show you some ideas for tasks that might help you not spend so much time on a repeated process.

If you press ⇧⌘B (or Ctrl + Shift + B on Windows/Linux) from the global Terminal menu, you will see the build tasks that are available:

Global build tasks from VS Code 

Selecting tsc:build - tsconfig.json will produce the .js files in the dist folder, as well as the .js.map files that will be created next to the .ts files since the outDir.

Another task that's available is tsc:watch tsconfig.json, which makes the TypeScript compiler watch for changes to your TypeScript files and runs the transpiler on each change.

There is also the possibility to define the TypeScript build task as the default build task. By doing so, every time you run the build task (⇧⌘B), the default task will be executed. To do so, select Configure Default Build Task and select TypeScript tsc : build. The following information should be included in the tasks.json file:

{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"type": "typescript",
"tsconfig": "tsconfig.json",
"problemMatcher": [
"$tsc"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.132.194