报错信息如下:
原因在于gulp打包时未将es6语法转为es5
1.首先在项目下进行安装gulp的babel转码
npm install --save-dev gulp-babel babel-core babel-preset-es2015
2.此时在gulp压缩配置文件内添加如下babel
var gulp = require(‘gulp‘), babel = require("gulp-babel"); gulp.task(‘minjs‘, function () { gulp.src(src_js+‘/**/*.js‘) .pipe(babel()) .pipe(uglify()) .pipe(gulp.dest(dest_js)); });
3.再次执行gulp即可
gulp打包报错 “Error: Unhandled 'error' event at new JS_Parse_Error”