Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
729 views
in Technique[技术] by (71.8m points)

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

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...