Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GulpUglifyError:Unable to minify JavaScript

I am trying to minify my script files for which i am using gulp task runner And I am trying gulp-uglify plugin

Code:

 gulp.task('concat', function() {     return gulp.src('app/**/*.js')         // .pipe(concat('script.js'))         .pipe(uglify())         .pipe(gulp.dest('./dist/')) }); 

but i am getting error as

enter image description here

when i try to run gulp task as gulp concat Any help would be appreciated

like image 734
swathi anupuram Avatar asked Nov 10 '16 06:11

swathi anupuram


1 Answers

The main error is generated when you're using ES6 format. Use the gulp-uglify-es module instead of 'gulp-uglify' to overcome this error.

var uglify = require('gulp-uglify-es').default; 

Note: gulp-uglify-es is no longer being maintained. You may want to use terser/gulp-terser instead:

like image 150
haouarin Avatar answered Sep 21 '22 23:09

haouarin