从ES6转换为ES5后,为什么js文件不起作用?

时间:2018-07-10 20:16:27

标签: javascript jquery gulp babel

这是我的大口饭代码:

var gulp = require('gulp');
const babel = require('gulp-babel');
var minifycss = require('gulp-minify-css');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify-es').default;
//var del = require('del');
var pump = require('pump');

var paths = {
    other: {
        scripts: [
            'js/s_o.js',
            'js/others.js',
            'js/beautiful-scrollbar.js',
            'js/popup_modal.js',
            'js/select_option_advanced.js',
            'js/textarea-output-emulator.js',
            'js/textarea-selection.js',
            'js/highlight.pack.js',
            'js/ltk_editor.js',
            'js/upload_image.js',
            'js/draggable_popup.js',
        ]
    }
};


// other scripts
gulp.task('other-scripts', function (cb) {
    pump([
        gulp.src(paths.other.scripts),
        concat('full-other.js'),
        uglify(),
        babel(),
        gulp.dest('bundle')
    ],
        cb
    );
});

直到uglify()都可以正常工作,但是当我添加babel()(转换为ES5)时,捆绑的文件甚至都不知道jQuery (它被附加在上方捆绑文件)。知道如何将ES6正确转换为ES6吗?

预先感谢

0 个答案:

没有答案