如何从 Javascript 中删除死代码

发布于 2024-11-24 21:13:42 字数 117 浏览 6 评论 0原文

我正在尝试从我的项目中删除未使用的功能。由于它有数千行,这需要很长时间。

代码覆盖工具可能会建议给定测试用例中未使用的函数,但仅依赖于此可能是危险的。

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

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

苍风燃霜 2024-12-01 21:13:42

你可以尝试一下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

怎言笑 2024-12-01 21:13:42

看看关于 Javascript 静态分析工具的这个问题。

Have a look at this question regarding Javascript static analysis tools.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文