[英]Source map doesn't work in vscode (nodemon debugging) in entire application
我有vscode( github repo )的nodemon调试配置。 调试时的Sourcemap除在本地(快速路由)外不起作用。 我想知道为什么:
.vscode / launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Quick Attach",
"port": 18531,
"sourceMaps": true,
"address": "localhost",
"restart": true
}
]
}
我的typecipt应用程序:
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;
和tsconfig.json
{
"compileOnSave": true,
"compilerOptions": {
"declaration": false,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"outDir": "./dist",
"sourceMap": true,
"skipLibCheck": true
},
"files": [
"index.ts"
]
}
还有我的nodemon命令: nodemon --inspect=18531 dist/index.js
和typescipt命令: tsc -w
我正在运行: -Windows 10企业版 -nodejs:9.2.0 - nodemon:1.12.1
好的,这可以在没有问题的nodejs 9.2.0的 MacOSX上正常运行 : launch.json
{
"type": "node",
"request": "launch",
"remoteRoot": "${workspaceRoot}/dist",
"name": "Lanuch full nodemon",
"runtimeExecutable": "nodemon",
"program": "${workspaceFolder}/dist/index.js",
"restart": true,
"sourceMaps": true,
"console": "internalConsole",
"internalConsoleOptions": "neverOpen"
}
tsconfig.json
{
"compileOnSave": true,
"compilerOptions": {
"declaration": false,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"watch": true,
"outDir": "./dist",
"rootDir": "./",
"sourceMap": true,
"skipLibCheck": true
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.