I have nodemon debug configuration with vscode (github repo) . Sourcemap while debugging doesn't work excepts on place (express route). I am wondering why is that :
.vscode/launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Quick Attach",
"port": 18531,
"sourceMaps": true,
"address": "localhost",
"restart": true
}
]
}
My typescipt application:
import * as http from 'http';
import * as url from 'url';
import * as express from 'express';
import * as bodyParser from 'body-parser';
import errorHandler = require('errorhandler');
import methodOverride = require('method-override');
const cors = require('cors');
const app = express();
let port: number = 3000;
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
app.use(methodOverride());
app.use(errorHandler());
app.use(cors());
app.get('/test', (req, res) => {
res.send('hello') // SOURCE MAP WORKS ONLY HERE
});
app.listen(port, function () {
console.log('Server listening on port %d in %s mode', port, app.settings.env);
});
export var App = app;
and tsconfig.json
{
"compileOnSave": true,
"compilerOptions": {
"declaration": false,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"outDir": "./dist",
"sourceMap": true,
"skipLibCheck": true
},
"files": [
"index.ts"
]
}
also my nodemon command:
nodemon --inspect=18531 dist/index.js
and typescipt command:
tsc -w
I am running: - Windows 10 Enterprise - nodejs: 9.2.0 - nodemon: 1.12.1
OK somehow this is working on my MacOSX with nodejs 9.2.0 without problems: launch.json
tsconfig.json