【问题标题】:gulpfile.js 4 infinity loopgulpfile.js 4 无限循环
【发布时间】:2019-08-27 14:26:19
【问题描述】:

我正在使用 gulp 版本 4,但我遇到了 javascript 任务的无限循环问题。我真的不明白是什么导致了循环。

// JS
function javascript() {
  return gulp
      .src([paths.js, paths.excludeJS.minJs, paths.excludeJS.underscored], {base: "./"})
      .pipe(plumber({errorHandler: onError}))
      .pipe(include({
        includePaths: [paths.source]
      }))
      .pipe(babel())
      .pipe(ignore.include(paths.excludeJS.underscored))
      .pipe(rename(function (path) {
        path.basename += ".min";
        path.extname = ".js";
      }))
      .pipe(gulp.dest("./"));
}

exports.default = watch;
exports.js = javascript;

【问题讨论】:

    标签: javascript gulp gulp-watch


    【解决方案1】:

    通过添加到监视函数忽略路径解决

    function watch(){
        gulp.watch(paths.sass, style);
        gulp.watch([paths.js, paths.excludeJS.minJs, paths.excludeJS.underscored], javascript);
    }

    【讨论】:

      猜你喜欢
      • 2013-11-29
      • 1970-01-01
      • 2014-04-27
      • 2018-04-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-11-30
      • 1970-01-01
      相关资源
      最近更新 更多