在 VS 2019 中,当我尝试访问Publish
文件夹Gulp
失败时,ReferenceError: merge is not defined
.
gulpfile.js
/// <binding AfterBuild='default' />
var gulp = require('gulp');
var uglify = require("gulp-uglify");
var concat = require("gulp-concat");
gulp.task('minify', function () {
return gulp.src("wwwroot/js/**/*.js")
.pipe(uglify())
.pipe(concat("dutchtreat.min.js"))
.pipe(gulp.dest("wwwroot/dist"));
});
var nodeModules = {
"bootstrap": { "dist/**/*": "" },
"font-awesome": { "**/*": "" },
"jquery": { "dist/*": "" },
"jquery-validation": { "dist/*": "" },
"jquery-validation-unobstrusive": { "dist/*": "" } };
gulp.task("node_modules", function () {
let streams = [];
for (var module in nodeModules) {
console.log("Prepping Scripts for: " + module);
for (var itemProp in nodeModules[module]) {
streams.push(gulp.src("node_modules/" + module + "/" + itemProp)
.pipe(gulp.dest("wwwroot/lib" + module + "/" + nodeModules[module][itemProp])));
}
}
return merge(streams);
});
gulp.task('default', gulp.series("node_modules", "minify"));
package.json "devDependencies"
"gulp": "4.0.2",
"gulp-uglify": "3.0.2",
"gulp-concat": "2.6.1",
"merge-stream": "2.0.0",
"merge": "1.2.1"
所有 5 个文件都加载到 Dependencies | npm 文件夹。
为什么找不到merge
?这种语法是否正确Gulp 4
?