javascript - gulpfile.js 4 无限循环
问题描述
我正在使用 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;
解决方案
通过添加到监视功能忽略的路径来解决
function watch(){
gulp.watch(paths.sass, style);
gulp.watch([paths.js, paths.excludeJS.minJs, paths.excludeJS.underscored], javascript);
}
推荐阅读
- swiftui - 如何对带有蒙版的视图应用模糊?
- flutter - 使用颤振中的指标在页面之间转换
- html - 生产中的剑道电子表格不显示字体图标
- angular - 仅从 Angular 视图调用方法一次
- visual-studio-2019 - VS2019 中缺少编辑项目选项
- c++ - 分配给元组时使用包扩展的序列点警告
- android - 将物品均匀地分成
- keycloak - SSO 开放 ID | 从一个客户端注销应该注销其他客户端
- apache-flink - Flink metric `flink_taskmanager_Status_JVM_CPU_Load{}` 在 Grafana Dashboard 中不准确
- logstash - Logstash 基于多路径的多索引