如何在browserify中获取依赖树?
发布时间:2020-12-13 20:46:41 所属栏目:百科 来源:网络整理
导读:有没有办法检索browserify用来构建bundle的依赖树? Browserify需要一堆脚本并制作好的捆绑包,解决所有需要的依赖项.但是我希望看到那些依赖关系的结构. var scripts = [ 'a.js','b.js' ];//a b require a lot of other scriptsvar b = browserify({ entries
有没有办法检索browserify用来构建bundle的依赖树?
Browserify需要一堆脚本并制作好的捆绑包,解决所有需要的依赖项.但是我希望看到那些依赖关系的结构. var scripts = [ 'a.js','b.js' ];//a & b require a lot of other scripts var b = browserify({ entries:scripts }); b.bundle().pipe(fs.createWriteStream('bundle.js')); //looking on b in debugger I can't find anything like dependency tree
来自
--list handler in the Browserify bin/cmd.js script的这段代码将为您提供一个平面的文件列表:
// Your setup: var scripts = [ 'a.js','b.js' ]; //a & b require a lot of other scripts var b = browserify({ entries: scripts }); // Logging out each of the filenames: b.pipeline.get('deps').push(require('through2').obj( function (row,enc,next) { console.log(row.file || row.id); next(); } )); // Bundle as normal: b.bundle().pipe(fs.createWriteStream('bundle.js')); (注意:您需要安装上面的 可以使用the code from the (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |