I'm trying to minify all of my AngularJS files to be compressed with gulp-uglify
. But the problem is I've used ES6 syntax in my project, especially arrow function
.
When I minify js file with as follow:
gulp.task('minify-scripts', function() {
return gulp.src(jsFiles)
.pipe(concat('scripts.js'))
.pipe(gulp.dest(jsDest))
.pipe(rename('scripts.min.js'))
.pipe(uglify())
.pipe(gulp.dest(jsDest));
});
for following ES6 code:
apiService.fetchAccessToken($scope.body).then((response) => {
encountered following error:
events.js:160 throw er; // Unhandled 'error' event
But when I reversed ES6 code to traditional code:
apiService.fetchAccessToken($scope.body).then(function(response) {
Everything is working fine. Please let me know what I've missed to configure something inside gulp to minify es6
code?