Browserify bundling 실패시 예외처리 추가
@0243fa402cab3329c5a20f67b0c1269840130048
--- step10_sourcemaps/gulpfile.js
+++ step10_sourcemaps/gulpfile.js
... | ... | @@ -30,6 +30,11 @@ |
| 30 | 30 |
gulp.task('uglify', function () {
|
| 31 | 31 |
return browserify({entries: ['src/js/main.js'], debug: true})
|
| 32 | 32 |
.bundle() //browserify로 번들링 |
| 33 |
+ .on('error', function (err) {
|
|
| 34 |
+ //browserify bundling 과정에서 오류가 날 경우 gulp가 죽지않도록 예외처리 |
|
| 35 |
+ console.error(err); |
|
| 36 |
+ this.emit('end');
|
|
| 37 |
+ }) |
|
| 33 | 38 |
.pipe(source('main.js')) //vinyl object 로 변환
|
| 34 | 39 |
.pipe(buffer()) //buffered vinyl object 로 변환 |
| 35 | 40 |
.pipe(sourcemaps.init({loadMaps: true, debug: true})) //소스맵 생성 준비
|
--- step9_browserify/gulpfile.js
+++ step9_browserify/gulpfile.js
... | ... | @@ -29,6 +29,11 @@ |
| 29 | 29 |
gulp.task('uglify', function () {
|
| 30 | 30 |
return browserify('src/js/main.js')
|
| 31 | 31 |
.bundle() //browserify로 번들링 |
| 32 |
+ .on('error', function (err) {
|
|
| 33 |
+ //browserify bundling 과정에서 오류가 날 경우 gulp가 죽지않도록 예외처리 |
|
| 34 |
+ console.error(err); |
|
| 35 |
+ this.emit('end');
|
|
| 36 |
+ }) |
|
| 32 | 37 |
.pipe(source('main.js')) //vinyl object 로 변환
|
| 33 | 38 |
.pipe(buffer()) //buffered vinyl object 로 변환 |
| 34 | 39 |
.pipe(uglify()) //minify 해서 |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?