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
when i try to run gulp task as gulp concat Any help would be appreciated
Try using this
To see the error in console:
To find the exact file, with line number of error register and run this task:
For me, it was a deprecated option "preserveComments" that generated the error (and completely crashed the script).
Found the issue using:
Have you used ES6 format in your script file? If so try ES5 now because when you do gulp-uglify it doesnt understand ES6 format as of now and after that try your code
and run the task
gulp concat
it will workI think the top answers here are not explaining how to get the error. The docs have a section on error handling:
So, just capture the error and do whatever you want with it (such as logging to console) to see the filename, line number, and additional info:
or in a larger context:
This gives you a super helpful error!
The main error to Unable to minifies JavaScript is the path not found. You can use the task usemin For this you need:
and requires :