GulpUglifyError:Unable to minify JavaScript

前端 未结 8 1826
感情败类
感情败类 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

    To see the error in console:

    var gutil = require('gulp-util');
    
    gulp.task('concat', function() {
    return gulp.src('app/**/*.js')
        // .pipe(concat('script.js'))
        .pipe(uglify())
        .on('error', function (err) { gutil.log(gutil.colors.red('[Error]'), err.toString()); })
        .pipe(gulp.dest('./dist/'))
    });
    

    To find the exact file, with line number of error register and run this task:

    var pump = require('pump');
    
    gulp.task('uglify-error-debugging', function (cb) {
      pump([
        gulp.src('app/**/*.js'),
        uglify(),
        gulp.dest('./dist/')
      ], cb);
    });
    

提交回复
热议问题