Welcome! Please see the About page for a little more info on how this works.

+1 vote
in ClojureScript by

First, thanks to everyone for their efforts on cljs, reagent, and everything else that makes this ecosystem tick. For those efforts, we all suffer less, and I am profoundly grateful.


We use {:optimizations :advanced} to produce a single .js file for production deployments of our ClojureScript web front ends.

The file size of the emitted .js varies a lot, and seems to correlate positively with the complexity of the project, which is good, but is often still a bit bigger than I'd like.

Is there a way, or are there tools, to analyze the contents of the emitted .js (maybe during compilation? or perhaps after the fact?) in order to discover what is using space in the output?

I'm dreaming of something like ncdu, but for my cljs build output.

With such tools we could perhaps find paths through the compilation that could produce smaller output. There may be accidental links that defeat the tree-shaker (or whatever).


Thanks in advance for your time and consideration.

1 Answer

+2 votes
by

I am not aware of a generic ClojureScript solution for this. If you’re using shadow-cljs you can generate a build report: https://shadow-cljs.github.io/docs/UsersGuide.html#_build_report

by
Wow, that sample output looks super-great. Not using shadow-cljs, but neat to know such a thing is possible. Thanks for this pointer.
...