我的gulp文件几乎像这样(简化)
function copyAssets () {
return src(paths.assets, { base: './' })
.pipe(cache('asset-files'))
.pipe(dest(paths.build))
}
// Some more task functions
const build = parallel(copyAssets, brewCoffee, buildTypescript)
module.exports = { build, watch: series(build, watchFiles) }
但是现在我列出它时看起来像:
[15:29:30] Tasks for .....
[15:29:30] ├─┬ <parallel>
[15:29:30] │ └─┬ <parallel>
[15:29:30] │ ├── copyAssets
[15:29:30] │ ├── brewCoffee
[15:29:30] │ └── buildTypescript
[15:29:30] └─┬ <series>
[15:29:30] └─┬ <series>
[15:29:30] ├─┬ <parallel>
[15:29:30] │ ├── copyAssets
[15:29:30] │ ├── brewCoffee
[15:29:30] │ └── buildTypescript
[15:29:30] └── watchFiles
并且运行诸如gulp build
之类的东西将说该任务不存在。
如果将系列/并行函数包装在一个匿名函数中,我的确会看到它出现在列表中(像这样)
const build = () => parallel(copyAssets, brewCoffee, buildTypescript)
module.exports = { build, watch: () => series(build, watchFiles) }
但是随后运行gulp build
时我会得到
Did you forget to signal async completion?
作为错误。
我知道这确实可行(几个月前)。但是现在由于某种原因,它不再存在。如果我运行gulp --version
,则输出为:
CLI version: 2.2.0
Local version: 4.0.0
编辑:嗯。这似乎有效
module.exports = { build: () => build(), watch: () => series(build, watchFiles)() }
但是我怀疑那是我实际上应该怎么做的事情。...
edit2:否,仍然损坏,它现在运行,并等待完成。然后说出与以前相同的错误:The following tasks did not complete: build
过去(非常简短地)使用并行时,我不得不从gulp中引用它。
例如更改:
const build = () => parallel(copyAssets, brewCoffee, buildTypescript);
至:
const build = () => gulp.parallel(copyAssets, brewCoffee, buildTypescript);
与此处的系列相同:
module.exports = { build, watch: gulp.series(build, watchFiles) }