如何从 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你可以尝试一下Google Closure编译器。它有不同的设置,您还可以自动删除死代码。您可以在这里尝试:http://closure-compiler.appspot.com/home
了解更多信息请阅读此处:http://code.google.com/closure/compiler/docs/compilation_levels.html
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
For more info read here: http://code.google.com/closure/compiler/docs/compilation_levels.html
看看关于 Javascript 静态分析工具的这个问题。
Have a look at this question regarding Javascript static analysis tools.