this post was submitted on 16 Jun 2025
162 points (98.2% liked)

Programmer Humor

36999 readers
582 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] Pieisawesome@lemmy.dbzer0.com 3 points 2 weeks ago

Tree shaking is essentially reducing the amount of included code to only the stuff being used.

Let’s say you have a JAR, DLL, or whatever with 5 functions.

Your application calls function A which also calls function B of the DLL/jar.

Tree shaking says “hmm, if I follow the code execution path, I only need 2/5 functions from the DLL/jar” and discards the remaining 3/5 functions.

This significantly reduces the bundle size (the bundle is what is sent to the browser).