Skip to content

compiler errors kill gulp-watch #585

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Spongman opened this issue Jul 17, 2018 · 4 comments
Closed

compiler errors kill gulp-watch #585

Spongman opened this issue Jul 17, 2018 · 4 comments

Comments

@Spongman
Copy link

can't post details, but typescript compiler errors cause gulp-watch to stop responding to file changes.

all packages are up-to-date.

the compiler errors, which are expected, are followed by this (new) suspicious text:

TypeScript: 2 semantic errors
TypeScript: emit succeeded (with errors)
(node:1256) UnhandledPromiseRejectionWarning: Error: TypeScript: Compilation failed
    at Output.mightFinish (C:\myproject\node_modules\gulp-typescript\release\output.js:130:43)
    at applySourceMap.then.appliedSourceMap (C:\myproject\node_modules\gulp-typescript\release\output.js:43:22)
(node:1256) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:1256) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
@k8w
Copy link

k8w commented Jul 19, 2018

+1

@samjudge
Copy link

samjudge commented Jul 29, 2018

Catching build errors to prevent the gulp watch process from crashing is covered in the "Reporters" section of the documentation. If you add .on("error",()=>{/*handle the error here*/}) after .pipe(tsProject()) or .pipe(ts(..)) then the gulp process will not die on ts syntax error :) (see #295) If you have multiple dependent build steps (such as running through your code through babel) you can set flags in above mentioned error handlers to make sure nothing bad happened

@AKApumkin
Copy link

+1, version 4.0.2 has a stable version if anyone needs a quick fix.

@ivogabe
Copy link
Owner

ivogabe commented Sep 11, 2018

This is an effect of #295. We now crash on compiler errors, which is especially desired in a CI context. However, for a watch build, you don't want to crash. When you install gulp 4, gulp will catch the error for you and continue working.

The solution by Sam is a good option if you cannot upgrade to Gulp 4 yet.

I'll keep this issue open, as you shouldn't get a UnhandledPromiseRejectionWarning. I will investigate that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants