Skip to content

Compile using tsconfig.json

Video Lecture

Compile, Run and Setup tsconfig.json Compile, Run and Setup tsconfig.json

Description

We can simplify the transpiling process by using a tsconfig.json

./src/server/tsconfig.json

1
2
3
4
5
6
7
8
9
{
  "compilerOptions": {
    "target": "ES6",
    "module": "commonjs",
    "outDir": "../../dist/server",
    "strict": true
  },
  "include": ["**/*.ts"]
}

To compile

tsc.cmd -p ./src/server

To serve the JavaScript output file

node dist/server/server.js

TSC Compiler Options

https://www.typescriptlang.org/docs/handbook/compiler-options.html