jonkemp / gulp-useref

Parse build blocks in HTML files to replace references to non-optimized scripts or stylesheets.
MIT License
705 stars 93 forks source link

[Error] GulpUglifyError: unable to minify JavaScript #237

Closed alicoding closed 7 years ago

alicoding commented 7 years ago

Hi,

I recently introduced es6 to my project which is still uses requirejs for its bundling but I'm having trouble getting past this task:

gulp.task('html', ['styles'], function() {

  return gulp.src('src/*.html')
      .pipe($.if('*.js', $.uglify()))
      .on('error', function (err) { util.log(util.colors.red('[Error]'), err.toString()); })
      .pipe(useref({searchPath: ['.tmp', 'src', '.']}))
      .pipe($.if('*.css', $.minifyCss({compatibility: '*'})))
      .pipe($.if('*.html', $.minifyHtml({conditionals: true, loose: true})))
      .pipe(gulp.dest('dist'));
});

One of the source file I added this:

[].map(b => {

});

And now I'm getting this error:

[Error] GulpUglifyError: unable to minify JavaScript
Caused by: SyntaxError: Unexpected token: operator (>)
File: Project/src/app/components/modals/bundle/modal.js
Line: 5

Any idea how I can integrate gulp-babel with this use case?

jonkemp commented 7 years ago

Seems like the problem is with uglify.

alicoding commented 7 years ago

You're probably right! I'm going to file an issue there.