GulpUglifyError:Unable to minify JavaScript

前端 未结 8 1835
感情败类
感情败类 2021-01-31 02:06

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() {         


        
8条回答
  •  伪装坚强ぢ
    2021-01-31 02:10

    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

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

    and run the task gulp concat it will work

提交回复
热议问题