Skip to content

Compile, Run and Setup tsconfig.json

Video Lecture

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

Compiling with options

To Compile the TypeScript file

tsc src/server/server.ts --outDir dist/server/ --esModuleInterop true

To serve the JavaScript output file

node dist/server/server.js

Compiling with tsconfig.json

./src/server/tsconfig.json

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

To compile

tsc -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