调试关闭编译器编译的Javascript [英] Debugging Closure-compiler Compiled Javascript

查看:136
本文介绍了调试关闭编译器编译的Javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个复杂的dojo应用程序未正确编译,但在使用Google Closure Compiler ,我在某些行为中有微妙的差异。

I have a complex dojo app that works correctly uncompiled, but after compiling with Google's Closure Compiler, I get subtle differences in some behaviours.

因为它是非常难调试,我一直无法找到有关可能的功能差异的任何信息编辑和未编译的Javascript与Google Closure。

As it is, it's exceedingly difficult to debug, and I've been unable to find any information about possible functional differences between compiled and uncompiled Javascript with Google Closure.

任何人都可以指出已知差异的方向,或分享任何类似的经历和一些想法,从哪里开始看? p>

Can anyone point me in the direction of known differences, or share any similar experiences and some ideas of where to start looking?

推荐答案

关闭编译器调试提示




  • 使用 VERBOSE 警告级别。这将打开所有检查。

  • 使用 debug 标志。它使得重命名的符号可笑的很长,但它们以这样的方式命名可以找到原始的。如果代码与 debug 标志一起使用,但没有它,则几乎肯定是重命名问题。

  • 绝对使用格式化= PRETTY_PRINT 。调试压缩的代码是没有它的痛苦。

  • 使用源地图

  • 使用禁用基于类型的优化 - use_types_for_optimization false 。不正确的类型注释可能导致编译器进行无效假设。

  • General Closure Compiler Debugging Tips

    • Use the VERBOSE warning level. This turns on all of the checks.
    • Use the debug flag. It makes renamed symbols ridiculously long, but they are named in such a way you can find the original. If code works with the debug flag but not without it, it is almost certainly a renaming issue.
    • Definitely use formatting=PRETTY_PRINT. Debugging compacted code is painful without it.
    • Use source maps
    • Disable the type based optimizations with --use_types_for_optimization false. Incorrect type annotations can cause the compiler to make invalid assumptions.
    • 更新:从20150315编译器版本开始,默认情况下启用优化。

      这篇关于调试关闭编译器编译的Javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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