每当 watchify 检测到更改时,打包时间就会变慢。我的 gulp 任务肯定有问题。有人有什么想法吗?
gulp.task('bundle', function() {
var bundle = browserify({
debug: true,
extensions: ['.js', '.jsx'],
entries: path.resolve(paths.root, files.entry)
});
executeBundle(bundle);
});
gulp.task('bundle-watch', function() {
var bundle = browserify({
debug: true,
extensions: ['.js', '.jsx'],
entries: path.resolve(paths.root, files.entry)
});
bundle = watchify(bundle);
bundle.on('update', function(){
executeBundle(bundle);
});
executeBundle(bundle);
});
function executeBundle(bundle) {
var start = Date.now();
bundle
.transform(babelify.configure({
ignore: /(bower_components)|(node_modules)/
}))
.bundle()
.on("error", function (err) { console.log("Error : " + err.message); })
.pipe(source(files.bundle))
.pipe(gulp.dest(paths.root))
.pipe($.notify(function() {
console.log('bundle finished in ' + (Date.now() - start) + 'ms');
}))
}
RangeError: Maximum call stack size exceeded
。 - Emily