0
我試圖實現express/typescript/gulp應用程序,它的工作原理,但我仍然無法使用源代碼映射調試它。在Visual Studio代碼中調試Express Types Gulp
這裏是我的設置
咕嘟咕嘟文件
var gulp = require('gulp'),
nodemon = require('gulp-nodemon'),
livereload = require('gulp-livereload'),
sourcemaps = require('gulp-sourcemaps'),
gulpPlumber = require('gulp-plumber'),
merge = require('merge2'),
ts = require('gulp-typescript');
var tsProject = ts.createProject('tsconfig.json');
gulp.task('typescript', function() {
console.log('Compiling TypeScript');
var tsResult = gulp.src(['src/**/*.ts'])
.pipe(gulpPlumber())
.pipe(sourcemaps.init())
.pipe(tsProject());
// merge dts & js output streams...
return merge([
// type definitions
tsResult.dts
.pipe(gulp.dest("./src/")),
// javascript
tsResult.js
//.pipe(sourcemaps.write(writeOptions))
.pipe(gulp.dest('./src/'))
]);
});
gulp.task('serve', ['typescript'], function() {
gulp.watch('./**/*.ts', ['typescript']);
livereload.listen();
nodemon({
script: './relax',
ext: 'js',
}).on('restart', function() {
setTimeout(function() {
console.log("reload!");
livereload.reload();
}, 500);
});
});
這裏是VS代碼啓動文件:
"configurations": [
{
"name": "Launch Program",
"type": "node2",
"request": "launch",
"program": "${workspaceRoot}\\relax.js",
"cwd": "${workspaceRoot}",
"outFiles": [],
"sourceMaps": true
},
{
"name": "Attach to Process",
"type": "node2",
"request": "attach",
"address": "localhost",
"restart": false,
"sourceMaps": false,
"localRoot": "${workspaceRoot}",
"remoteRoot": null,
"port": 5858
}
]
完整的代碼可以在git倉庫被發現在:https://github.com/MichalZak/beanbag
我無法將此過程附加到我的節點服務器。有什麼建議麼?
謝謝,尋求幫助。 –
@MikeZak不客氣:) –