如何分析Closure编译器包大小

如何分析Closure编译器包大小

问题描述:

我在ClojureScript中有一个应用程序,它使用Google的Closure Compiler作为编译器后端。使用高级优化的结果捆绑包似乎太大了。我责怪依赖关系但是如何找出输出包中哪些模块占用的字节数最多?我扫描了所有Closure Compiler选项,但没有找到任何有用的东西。然后我尝试了解源映射并使用它来计算单个模块大小但没有成功。

I have an app in ClojureScript, which uses Google's Closure Compiler as a compiler backend. The resulting bundle using advanced optimizations seems way too big for what it is. I blame the dependencies but how do I find out which modules are taking the most bytes in the output bundle? I scanned through all the Closure Compiler options and didn't find anything useful. Then I tried to learn about source maps and use that to calculate individual module size but with no success.

我想要一个树状输出,我可以挖掘和找到最大的模块大小,例如。

I would like a tree-like output where I can dig in and find the biggest modules in terms of size, eg.


  • [+] goog 100kb


    • [+] goog.net 30kb

    • [+] goog 100kb
      • [+] goog.net 30kb

      • [+] my.namespace 30kb

      • [+] my.namespace 30kb

据我所知,这样的工具可以不存在。尽管如此,这将是一个很好的。

To my knowledge, such a tool does not exist. It would be an excellent one to have though.

该工具无需特定于Closure Compiler。相反,分析输出源映射可以将代码中的特定符号归因于特定的输入文件。

The tool need not be specific to Closure Compiler. Instead, analyzing the output source map could attribute specific symbols in the code to specific input files.