Gulp concat jQuery 抛出错误

Gulp concat jQuery throws error

我是 gulp 的新手。我正在尝试将几个 JS 文件合并在一起,当我添加 jQuery(或 jQuery UI)时,编译器会抛出错误:

events.js:160
  throw er; // Unhandled 'error' event
  ^
Error: [path]\public\components\jquery\dist\jquery.js:16:2: missing '}'

我的 jQuery 是通过 Bower(版本 3.2.1)进行的全新复制,jQuery UI (1.12.1).

我的 gulp 任务如下:

gulp.task('js', function() {
    gulp.src(
        [
            config.bowerDir + '/jquery/dist/jquery.js',
            config.bowerDir + '/jquery-ui/jquery-ui.js',
            './public/js/custom.js'
        ]
    )
        .pipe(concat('script.js'))
        .pipe(gulp.dest('./public/js/'));
} );

非常感谢任何帮助。

gulp.task('js', function() {
  return gulp.src([
        config.bowerDir + '/jquery/dist/jquery.js',
        config.bowerDir + '/jquery-ui/jquery-ui.js',
        './public/js/custom.js'
    ])
    .pipe(concat('script.js'))
    .pipe(gulp.dest('./public/js/'));
});

抱歉大家,问题出在我自己的愚蠢上。我的 concat 函数实际上是 gulp-concat-css 而不是 gulp -连接。我花了三天时间才发现错误。

(...)
var concat = require('gulp-concat');
(...)

gulp.task('js', function() {
    return gulp.src([
            config.bowerDir + '/jquery/dist/jquery.js',
            config.bowerDir + '/jquery-ui/jquery-ui.js',
            './public/js/custom.js'
        ])
        .pipe(concat('scripts.js'))
        .pipe(gulp.dest('./public/js/'));