-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use gulp and babel to make es5 output
- Loading branch information
1 parent
19e0a57
commit bfbe71b
Showing
5 changed files
with
6,263 additions
and
593 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
10.12.0 |
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const gulp = require('gulp'); | ||
const babel = require('gulp-babel'); | ||
const sourcemaps = require('gulp-sourcemaps'); | ||
const ts = require('gulp-typescript'); | ||
const gulpif = require('gulp-if'); | ||
|
||
const tsProj = ts.createProject('tsconfig.json'); | ||
|
||
const babelConfig = { | ||
"presets": [ | ||
// Target supported browser environments | ||
["@babel/preset-env", { "targets": "> 0.25%, not dead" }] | ||
], | ||
"plugins": [ | ||
// Enable generator runtime support | ||
["@babel/plugin-transform-runtime", { "regenerator": true }] | ||
], | ||
}; | ||
|
||
function build() { | ||
return gulp.src('src/**/*.ts') | ||
.pipe(sourcemaps.init()) | ||
.pipe(tsProj()) | ||
.pipe(gulpif(/[.]js$/, babel(babelConfig))) | ||
.pipe(sourcemaps.write('.')) | ||
.pipe(gulp.dest('target/src')); | ||
}; | ||
|
||
exports.default = build; |
Oops, something went wrong.