-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BUGFIX] - Issue #46 - server side babel resiliency
- Loading branch information
1 parent
c96c168
commit 5d084dd
Showing
1 changed file
with
23 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,34 @@ | ||
import gulp from 'gulp'; | ||
import { log } from 'gulp-util'; | ||
import changed from 'gulp-changed'; | ||
import babel from 'gulp-babel'; | ||
import config from './../configs/config'; | ||
|
||
gulp.task('babel-server', function babelServer() { | ||
const babelStream = babel({ | ||
sourceMaps: 'inline', | ||
presets: [ | ||
'react', | ||
[ | ||
'env', | ||
{ | ||
targets: { | ||
node: 'current' | ||
} | ||
} | ||
] | ||
] | ||
}); | ||
|
||
babelStream.on('error', function handleError(err) { | ||
log(`Error transpiling babel in gulp_babel_server task.`); | ||
log(err); | ||
babelStream.end(); | ||
}); | ||
|
||
return gulp | ||
.src(config.server.src) | ||
.pipe(changed(config.dest)) | ||
.pipe( | ||
babel({ | ||
sourceMaps: 'inline', | ||
presets: [ | ||
'react', | ||
[ | ||
'env', | ||
{ | ||
targets: { | ||
node: 'current' | ||
} | ||
} | ||
] | ||
] | ||
}) | ||
) | ||
.pipe(babelStream) | ||
.pipe(gulp.dest(config.dest)); | ||
}); |