[英]gulpfile.js 4 infinity loop
I'm using gulp version 4, and I'm having problem with infinity loop of the javascript task. 我正在使用gulp版本4,并且javascript任务的无限循环出现问题。 I don't really understand what is causing the loop.
我不太了解是什么原因导致了循环。
// 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;
solved by adding to the watch function ignored paths 通过向watch函数添加忽略的路径来解决
function watch(){ gulp.watch(paths.sass, style); gulp.watch([paths.js, paths.excludeJS.minJs, paths.excludeJS.underscored], javascript); }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.