gulp-babel

const gulp = require('gulp');
const babel = require('gulp-babel');

gulp.task('default', () =>
    gulp.src('src/app.js')
        .pipe(babel({
            presets: ['es2015'],
            modules: "amd" // 默认是 common,也可以改成 umd
        }))
        .pipe(gulp.dest('dist'))
);

因amd和commonjs都是require
转换时默认commonjs,如需AMD转换,也可以填写UMD

你可能感兴趣的:(gulp-babel)