【发布时间】:2026-01-04 11:40:02
【问题描述】:
我正在尝试在现有项目中升级到 Gulp 4。我创建了一个名为 vendor 的任务,目的是连接和缩小全局 javascript 包。不幸的是,我在使用以下代码进行编译时收到错误消息:
function vendor() {
const source = [
'./node_modules/@popperjs/core/dist/umd/popper.js',
'./node_modules/bootstrap/dist/js/bootstrap.js',
'./node_modules/slick-carousel/slick/slick.js'
];
return src(source)
.pipe(changed(source))
.pipe(concat('vendor.js'))
.pipe(uglify())
.pipe(rename({
extname: '.min.js'
}))
.pipe(dest('./dist/js/'))
}
exports.build = series(parallel(vendor, js));
我收到的错误是TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type object。
【问题讨论】:
-
看来我的具体问题与
gulp-changed有关,因为从我的供应商任务中删除它会导致build任务成功完成。