I have created a gulp / typescript workflow that performs the following actions.
- gulp.watch(..)
- gulp-typescript
- gulp-uglify
- gulp-sourcemaps
using the following..
var tsProject = ts.createProject('tsconfig.json') // See below for options
gulp.task('watch-ts', function () {
return gulp.watch(paths.scriptSrc + '/**/*.ts', ['compile-ts']);
});
gulp.task('compile-ts', function () {
var tsResult = gulp
.src(paths.scriptSrc + '/**/*.ts')
.pipe(sourcemaps.init())
.pipe(ts(tsProject));
return tsResult
.js
.pipe(uglify())
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(paths.scripts));
});
{
"compilerOptions": {
"outFile": "app.js",
"target": "es5",
"removeComments": true,
"noImplicitAny": false,
"module": "system",
"experimentalDecorators": true,
"declaration": false,
"noEmitOnError": true
}
}
So after the js file + sourcemap have been created, when i attempt to step in and debug in one of my typescript files using the Chrome debugger the breakpoints jump all over the place and one line jumps to some random line for each F10 press. I believe something strange has happened when generating the sourcemaps but dont know what.
If i comment out ".pipe(uglify())" then i can debug perfectly and there are no problems.
Does anyone know what could be causing this behavior?