Skip to content

Commit b2635de

Browse files
committed
Update documentation on compilation errors in gulp 3, fix #585
1 parent cf80732 commit b2635de

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

readme.md

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,12 @@ gulp-typescript
22
===============
33
A gulp plugin for handling TypeScript compilation workflow. The plugin exposes TypeScript's compiler options to gulp using TypeScript API.
44

5+
This plugin works best with gulp 4. If you cannot update to this version, please see the section "Gulp 3" below.
6+
57
Updating from version 2? See the [breaking changes in version 3](http://dev.ivogabe.com/gulp-typescript-3/).
68

79
[![Build Status](https://travis-ci.org/ivogabe/gulp-typescript.svg?branch=master)](https://travis-ci.org/ivogabe/gulp-typescript)
810

9-
Features
10-
--------
11-
- Incremental compilation (so faster builds)
12-
- Error reporting
13-
- Different output streams for .js, .d.ts files.
14-
- Support for sourcemaps using gulp-sourcemaps
15-
- Compile once, and filter different targets
16-
1711
How to install
1812
--------------
1913
##### 1. Install gulp CLI
@@ -22,7 +16,7 @@ npm install --global gulp-cli
2216
```
2317
##### 2. Install gulp in the project dependency
2418
```shell
25-
npm install gulp
19+
npm install gulp@4
2620
```
2721
##### 3. Install gulp-typescript & TypeScript
2822
```shell
@@ -245,7 +239,7 @@ const project = ts.createProject('test/customTransformers/tsconfig.json', {
245239

246240
Reporters
247241
---------
248-
By default, errors are logged to the console and the build crashes on compiler errors. In watch mode, the build does not throw, meaning that consequent builds are still ran. If you do not want to crash the gulp process, you must catch the error. You then need to add `.on('error', () => {})` after `.pipe(tsProject())` or `.pipe(ts(..))`.
242+
By default, errors are logged to the console and the build crashes on compiler errors. In watch mode, the build does not throw, meaning that consequent builds are still ran. Note that gulp 4 is required for this behaviour. If you are still using gulp 3, see the section "Gulp 3" below.
249243

250244
If you want to change the way that messages are logged to the console (or some other output), you can provide a reporter. You can specify a custom reporter as the second argument of the main function, or as the only argument when using a `tsProject`:
251245
```javascript
@@ -260,6 +254,19 @@ Available reporters are:
260254

261255
If you want to build a custom reporter, you take a look at `lib/reporter.ts`, that file declares an interface which a reporter should implement.
262256

257+
Gulp 3
258+
------
259+
This plugin works best with gulp 4. If you cannot update to this version, you may experience problems when using incremental compilations with a watcher. A compilation error will namely crash the process, which is desired in a CI environment. Gulp 4 prevents that the process crashes in watch mode. This does not happen in gulp 3, so you will need to handle that manually.
260+
261+
You should attach an error handler to catch those compilation errors.
262+
263+
```js
264+
gulp.src(..)
265+
.pipe(ts(..))
266+
.on('error', () => { /* Ignore compiler errors */})
267+
.pipe(gulp.dest(..))
268+
```
269+
263270
Build gulp-typescript
264271
------------
265272

0 commit comments

Comments
 (0)