Minify the code generated by the webpack using gulp

0

This is the JavaScript task of my gulpfile.js :

gulp.task('js', function () {
  gulp.src('_front-end/js/index.js')
    .pipe(babel({ presets: ['env'] }))
    .pipe(webpack({ output: { filename: 'all.js' }}))
    .pipe(gulp.dest('_front-end-src'))
  ;
});

But he can not minify JavaScript. I already tried to use uglify , but it did not work, considering that it returned this error:

internal/streams/legacy.js:59
      throw er; // Unhandled stream error in pipe.
      ^
GulpUglifyError: unable to minify JavaScript
    at createError (C:\wamp\www\gthod\node_modules\gulp-uglify\lib\create-error.js:6:14)
    at apply (C:\wamp\www\gthod\node_modules\lodash\_apply.js:16:25)
    at wrapper (C:\wamp\www\gthod\node_modules\lodash\_createCurry.js:41:12)
    at C:\wamp\www\gthod\node_modules\gulp-uglify\lib\minify.js:54:15
    at DestroyableTransform._transform (C:\wamp\www\gthod\node_modules\gulp-uglify\composer.js:10:23)
    at DestroyableTransform.Transform._read (C:\wamp\www\gthod\node_modules\readable-stream\lib\_stream_transform.js:182:10)
    at DestroyableTransform.Transform._write (C:\wamp\www\gthod\node_modules\readable-stream\lib\_stream_transform.js:170:83)
    at doWrite (C:\wamp\www\gthod\node_modules\readable-stream\lib\_stream_writable.js:406:64)
    at writeOrBuffer (C:\wamp\www\gthod\node_modules\readable-stream\lib\_stream_writable.js:395:5)
    at DestroyableTransform.Writable.write (C:\wamp\www\gthod\node_modules\readable-stream\lib\_stream_writable.js:322:11)
    
asked by anonymous 28.10.2017 / 22:17

0 answers