The package.json
scripts section should look like:
"scripts" : {
"build": "tsc",
"prestart": "npm run build",
"start": "node out/index.js",
...
}
My tsconfig.json
is looking like this:
{
"compilerOptions": {
"outDir": "./out",
"rootDir": "./src",
"sourceMap": true,
"moduleResolution": "node",
"target": "es5",
"experimentalDecorators": true,
"emitDecoratorMetadata": true
}
}
To run just use:
npm run start
For debuging in vscode
here's launch.json
:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}/src/index.ts",
"preLaunchTask": "tsc: build - tsconfig.json",
"outFiles": ["${workspaceFolder}/out/**/*.js"]
}
]
}
Cheers!