我正在使用gulp-browserify。如果我单独使用它,它的工作原理。但是,如果我将它们结合起来,我会得到:
错误:无法找到模块'功能e(t,n,r)
这是我的意思:
gulp.task("babel", function () {
return gulp.src("src/**/*.js")
.pipe(sourcemaps.init())
.pipe(babel())
.pipe(browserify({
transform:['babelify']
}))
.pipe(concat("all.js"))
.pipe(sourcemaps.write("."))
.pipe(gulp.dest("dist"));
});
版本:
"devDependencies": {
"babel-cli": "^6.3.17",
"babel-preset-es2015": "^6.3.13",
"babel-preset-react": "^6.3.13",
"babel-preset-stage-0": "^6.3.13",
"babelify": "^7.2.0",
"gulp": "^3.9.0",
"gulp-babel": "^6.1.1",
"gulp-browserify": "^0.5.1",
"gulp-concat": "^2.6.0",
"gulp-connect": "^2.3.1",
"gulp-sourcemaps": "^1.6.0",
"karma": "^0.13.18",
"karma-browserify": "^4.4.2",
},
答案 0 :(得分:1)
当您真正想要的是浏览连接文件时,您正在连接多个浏览器文件
gulp.task("babel", function () {
return gulp.src("src/**/*.js")
.pipe(sourcemaps.init())
.pipe(babel())
.pipe(concat("all.js")) // << First concat
.pipe(browserify({ // << Then browserify
transform:['babelify']
}))
.pipe(sourcemaps.write("."))
.pipe(gulp.dest("dist"));
});