https://kotlinlang.org logo
#compose-web
Title
# compose-web
b

Big Chungus

08/07/2021, 9:35 PM
Bundle sizes of compose-web are very concerning. my mock sandbox app (that doesn't do anything really..) comes up as 7+MB as production executable. I'm attaching the output if anyone's interested. The source is here. Development bundle is going at 26MB.
🤨 1
m

MrPowerGamerBR

08/07/2021, 9:41 PM
That's weird, my production executable for my project (a very simple one, but has multiple screens) that includes ktor (which is a big pain when including in a Kotlin/JS project due to its size) only uses ~1.7MB
By the way, one of the reasons that JS seems incredibly big, is because you are including FontAwesome's icon SVGs in your code, so the SVGs are embedded in the JS file
👍 1
b

Big Chungus

08/07/2021, 10:04 PM
Ah, that must be it. And I'm guessing that's not getting treeshaken by webpack, is it?
m

MrPowerGamerBR

08/07/2021, 10:09 PM
If it is in the production executable, then I guess they aren't 😛
😁 1
If you want to take a look, search for
var p={
and you will find all the references related to the FontAwesome stuff It is a key -> value map containing the FontAwesome icon name -> SVG data
b

Big Chungus

08/08/2021, 7:43 AM
After switching to explicit SVGs from FA, js file size dropped to 3.8MB, which is still alarming, but definitelly an improvement.
👀 1
c

CLOVIS

08/08/2021, 12:01 PM
Using TailwindCSS+React+Ktor, my project is ~2MB, so ~3.5MB for a Compose app sounds believable
It's a shame that Kotlin JS takes that much space, but hopefully that'll improve in the future
b

Big Chungus

08/08/2021, 12:17 PM
I suspect MDC css contributes to most of the bloat
c

CLOVIS

08/08/2021, 5:49 PM
It could be interesting to setup PurgeCSS then
b

Big Chungus

08/08/2021, 6:45 PM
Is it like treeshaking, but for css? What does it take as an entrypoint?
c

CLOVIS

08/08/2021, 8:42 PM
Yep pretty much. It takes your code (where you use CSS classes) and removes all classes that are unused from your CSS declaration. I haven't used it with Compose yet, but it should be doable with some Webpack config. https://purgecss.com/
It's not perfect though and has some big limitations, that might make it unusable for Compose. I don't know.
l

louiscad

08/09/2021, 12:42 PM
26MB: That would have taken almost 4 minutes to download with my 1Mbps download home internet connection (ADSL 2+) 4-5 years ago 😬
3 Views