Why is your elm.js file so big?
Is Elm’s dead code elimination on a particular function not working as you expected?
What libraries cost your users bandwidth?
Analyse your elm.js file size with this tool.
elmjs-inspect
I’ve had a couple of scripts lying around that would parse the elm.js file that your elm code compiles into and would give you a sorted list of functions and how much percent of bytes it takes up in that file.
With a bunch of help from @miniBill and more recently @pdamoc it’s now a little more polished (thanks!): It’s uploaded to npm, so you can simply install the CLI via npm i elmjs-inspect
and run it like this:
$ elm make src/Main.elm --output=elm.js
Success!
Main ───> elm.js
$ elmjs-inspect elm.js --summary=package
37.601%: author/project
33.004%: Kernel Code
12.632%: elm/core
5.022%: elm_community/typed_svg
2.360%: mpizenberg/elm_pointer_events
1.872%: elm/json
1.322%: elm/url
0.649%: elm/html
0.572%: elm_community/list_extra
0.557%: elm/virtual_dom
0.487%: avh4/elm_color
0.120%: elm/browser
0.039%: elm/svg
Range sum: 231878 total: 240946, analyzed 96.237%
You can also pass other things to get different levels of summaries:
$ elmjs-inspect --help
Usage: elmjs-inspect [options] <filename>
Analyse your elm.js file size with this tool.
Arguments:
filename The file to analyze
Options:
-V, --version output the version number
-s, --summary [value] Display summary. Possible values: module, package, project
-h, --help display help for command