Javascript GulpJS无法在列表中正确找到任务(Gulp4)
我的吞咽文件大致如下(简化) 但现在当我列出它时,它看起来像:Javascript GulpJS无法在列表中正确找到任务(Gulp4),javascript,node.js,build,gulp,system,Javascript,Node.js,Build,Gulp,System,我的吞咽文件大致如下(简化) 但现在当我列出它时,它看起来像: [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] 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
但是当运行gulpbuild
时,我会
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:没有,还是坏了,现在运行,等待完成。然后说了和以前一样的错误:以下任务没有完成:build
当我过去使用parallel(非常简短)时,我不得不从gulp引用它
例如,改变:
const build = () => parallel(copyAssets, brewCoffee, buildTypescript);
致:
与此处的系列相同:
module.exports = { build, watch: gulp.series(build, watchFiles) }
试试这个:
var srcPaths = {
app: [
'wwwroot/app/**/*.ts'
],
js: [
'node_modules/core-js/client/shim.min.js',
'node_modules/zone.js/dist/zone.js',
'node_modules/reflect-metadata/Reflect.js',
'node_modules/systemjs/dist/system.src.js',
'node_modules/typescript/lib/typescript.js',
'node_modules/ng2-bootstrap/bundles/ng2-bootstrap.min.js',
'node_modules/moment/moment.js'
],
}
gulp.task('watch', function () {
gulp.watch([srcPaths.app, srcPaths.js], gulp.series('js'));
});
它会很好用的。享受吧
brewCoffee
、buildTypescript
和watchFiles
的返回值是多少?答案已更新据我所知,这是“旧的”v3语法。这确实有效,但澄清不是我想要的,而是谢谢。
const build = () => gulp.parallel(copyAssets, brewCoffee, buildTypescript);
module.exports = { build, watch: gulp.series(build, watchFiles) }
var srcPaths = {
app: [
'wwwroot/app/**/*.ts'
],
js: [
'node_modules/core-js/client/shim.min.js',
'node_modules/zone.js/dist/zone.js',
'node_modules/reflect-metadata/Reflect.js',
'node_modules/systemjs/dist/system.src.js',
'node_modules/typescript/lib/typescript.js',
'node_modules/ng2-bootstrap/bundles/ng2-bootstrap.min.js',
'node_modules/moment/moment.js'
],
}
gulp.task('watch', function () {
gulp.watch([srcPaths.app, srcPaths.js], gulp.series('js'));
});