Bower component Quilljs editor module (ES6) is fai

2019-01-29 03:06发布

问题:

I am getting the error

events.js:160
      throw er; // Unhandled 'error' event
      ^
Error: scripts/vendor.js: error: couldn't process source due to parse error
'import' and 'export' may appear only with 'sourceType: module' (176000:0)

gulp file

//

 gulp.task('bower', ['clean'], function () {
  gulp.start('bower:build');
});

gulp.task('bower:build', ['bower:scripts', 'bower:styles', 'bower:scss', 'bower:scripts:minify', 'bower:styles:minify']);

gulp.task('bower:scripts', ['bower:partials'], function() {
  return gulp.src([
    path.join(paths.src, '/app/triangular/**/*.js'),
    path.join(paths.tmp, 'partials', 'templateCacheHtml.js')
  ])
    .pipe($.angularFilesort())
    .pipe($.ngAnnotate())
    .pipe($.concat('triangular.js'))
    .pipe(gulp.dest(paths.dist + '/'));
});

gulp.task('bower:scripts:minify', ['bower:scripts'], function() {
  return gulp.src(paths.dist + '/**/*.js')
    .pipe($.uglify())
    .pipe($.rename(function (path) {
      path.extname = '.min.js';
    }))
    .pipe(gulp.dest(paths.dist + '/'));
});

//

One of the bower library for quilljs editor [https://github.com/quilljs/quill] is in ES6, which is preventing the creation of minified vendor.js and build fails... I tried to added some babeljs task, but to no use.

How to use this babel, bowersify and bundle? What is the steps to use them before or after minify? What are its other use-cases ?

Source I followed: http://ramkulkarni.com/blog/setting-up-es6-babel-gulp/ https://gist.github.com/alkrauss48/a3581391f120ec1c3e03