如何从Javascript中删除死代码 [英] How to remove dead code from Javascript

查看:104
本文介绍了如何从Javascript中删除死代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从项目中删除未使用的函数。由于它有数千行,这需要永远。

I am trying to remove unused functions from my project. Since it has thousands of lines, this takes forever.

代码覆盖工具可能会建议在给定的测试用例中没有使用的函数,但仅依赖它可能是危险的在这个。

Code coverage tools may suggest functions that are not used in a given test case, but it may be dangerous to rely only on this.

还有其他工具可以帮助解决这个问题吗?

Is there another tool which can help with this?

推荐答案

您可以尝试使用Google Closure编译器。它有不同的设置,您也可以自动删除死代码。你可以在这里试试: http://closure-compiler.appspot.com/home

You can try Google Closure compiler. It has different settings and you can also remove dead code automatically. You can try it here: http://closure-compiler.appspot.com/home

欲了解更多信息,请阅读: http://code.google.com/closure/compiler/docs/compilation_levels.html

For more info read here: http://code.google.com/closure/compiler/docs/compilation_levels.html

这篇关于如何从Javascript中删除死代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆