Skip to content Skip to sidebar Skip to footer

How To Analyze Closure Compiler Bundle Size

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 bl

Solution 1:

shadow-cljs can generate Build Reports which take the advanced compiled output and analyze the source maps and then combines it with some of the compiler information to group sources by artifact and so on. The report is generated as a standalone .html file.

A sample build report can be found here. The build included "antd" package from npm. A comparison report that just included "antd/es/button" can be found here.

Note that this is limited to shadow-cljs as it relies on having all source map data available. Analyzing the source maps of CLJS builds generated by other tools misses source maps for all CLJSJS content and thus will include a lot of "gaps".

Solution 2:

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

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.

Post a Comment for "How To Analyze Closure Compiler Bundle Size"