Bower component Quilljs editor module (ES6) is failing while running gulp build

孤街醉人 提交于 2019-11-30 09:40:32

问题


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

来源:https://stackoverflow.com/questions/41800618/bower-component-quilljs-editor-module-es6-is-failing-while-running-gulp-build

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!