Turn ES6 code into vanilla ES5 with no runtime required using babel
Issues with the output should be reported on the babel issue tracker.
$ npm install --save-dev gulp-babelvar gulp = require('gulp');
var babel = require('gulp-babel');
gulp.task('default', function () {
return gulp.src('src/app.js')
.pipe(babel())
.pipe(gulp.dest('dist'));
});See the babel options, except for sourceMap and filename which is handled for you.
Use gulp-sourcemaps like this:
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var babel = require('gulp-babel');
var concat = require('gulp-concat');
gulp.task('default', function () {
return gulp.src('src/**/*.js')
.pipe(sourcemaps.init())
.pipe(babel())
.pipe(concat('all.js'))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('dist'));
});MIT © Sindre Sorhus