我有一个简单的构建脚本,据说应该使用 browserify 将我所有的 js 模块打包到一个文件中。我有以下代码(灵感来自http://www.forbeslindesay.co.uk/post/46324645400/standalone-browserify-builds)
function _browserify(srcPath, distPath) {
var browserify = require('browserify');
var b = new browserify();
b.add(srcPath);
b.bundle().pipe(_fs.createWriteStream(distPath));
console.log(' '+ distPath +' built.');
}
但是当我运行它时,我得到一个完全空的文件。知道为什么吗?