最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - require.js dependency analysis tool - Stack Overflow

programmeradmin2浏览0评论

How to detect circular dependencies from a project built using requir.js?

For instance

/* File: MyView.js */
define(['backbone','views/myview','object_x'], function(BB,V,X){
   ...
});

/* File: Object_X.js */
define(['backbone','jquery','views/myview','object_x'], function(BB,$,V,X){
   ...
});

what I mean is that as the project gets bigger, manually inspecting each file becomes a hassle.

Edit: How about detecting redundant dependencies?

How to detect circular dependencies from a project built using requir.js?

For instance

/* File: MyView.js */
define(['backbone','views/myview','object_x'], function(BB,V,X){
   ...
});

/* File: Object_X.js */
define(['backbone','jquery','views/myview','object_x'], function(BB,$,V,X){
   ...
});

what I mean is that as the project gets bigger, manually inspecting each file becomes a hassle.

Edit: How about detecting redundant dependencies?

Share Improve this question edited Jun 2, 2013 at 23:07 user1406062 asked Jun 2, 2013 at 20:43 user1406062user1406062 8835 silver badges16 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 22

I Googled your title word-for-word, and this was the first result...

https://npmjs.org/package/madge

Use r.js to optimize the code. During build process it will list files that were included while building.

If you want to do more dependency graph analysis the semi-private onResourceLoad API may be helpful.

发布评论

评论列表(0)

  1. 暂无评论