gulp.task("f1", () => {
gulp.src([], {"allowEmpty": true})
.pipe(gulp.dest(location));
})
Error: Invalid glob argument: is thrown for the above snippet
gulp.task("f1", () => {
gulp.src("[]", {"allowEmpty": true})
.pipe(gulp.dest(location));
})
whereas, it is working fine. Is this the expected behaviour ? Anyway to use allowEmpty for empty array ?
Anyhow the issue can be solved by skipping the task for empty array, just wondering is there any proper way to use allowEmpty for empty array.
Any suggestion would be helpful. Thanks in advance
1条答案
按热度按时间wn9m85ua1#
这是预期的行为。
src()
的第一个参数需要一个字符串或字符串数组,而不是空数组。allowEmpty
选项只是抑制在找不到匹配时抛出的错误-它不会更改第一个参数中可以传递的内容。