Compile, Run and Setup tsconfig.json

Video Lecture

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

Compiling with options

To Compile the TypeScript file

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

To serve the JavaScript output file

1
node dist/server/server.js

Compiling with tsconfig.json

src/server/tsconfig.json

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

To compile

1
tsc -p src/server

To serve the JavaScript output file

1
node dist/server/server.js

TSC Compiler Options

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