From d228ff9fbd386ea5c4b0bdd792dd3be8bf01895d Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Sat, 22 Feb 2020 11:20:41 +0000 Subject: [PATCH] Tools: Improve tsc watch --- gulpfile.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gulpfile.js b/gulpfile.js index b0fc76073e..8aa0d50f49 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,6 +1,7 @@ const gulp = require('gulp'); const glob = require('glob'); const ts = require('gulp-typescript'); +const execa = require('execa'); const utils = require('./Tools/gulp/utils'); const tasks = { @@ -54,7 +55,12 @@ gulp.task('updateIgnoredTypeScriptBuild', updateIgnoredTypeScriptBuildTask); gulp.task('watch', function() { gulp.watch(tasks.copyLib.src, tasks.copyLib.fn); - gulp.watch(tscTaskSrc, gulp.series('tsc', 'updateIgnoredTypeScriptBuild')); + gulp.watch(tscTaskSrc, updateIgnoredTypeScriptBuildTask); + + // For watching, we use the actual tsc tool because it's more robust and + // doesn't crash when there's an error + const promise = execa('npx', ['tsc', '--watch', '--project', 'tsconfig.json'], { cwd: `${__dirname}` }); + promise.stdout.pipe(process.stdout); }); gulp.task('build', gulp.series('copyLib', 'tsc', 'updateIgnoredTypeScriptBuild'));