World Congress 2024

Tree Shaking the Bytes Away

July 19, 2024 13:00 – 13:30 · 30 min STAGE 8 (120)

What this session covers

Today, JavaScript has become incredibly powerful. But with great power comes great responsibility - and every feature you add to your application or library results in additional bytes that have to be delivered to your users over the network. One way to deal with this is “tree shaking” - a technique to remove unused code from your application. While most modern bundlers like Webpack and Vite will automatically do this for you, their ability to do so properly depends a lot on how you write your code. This talk will explain the concept of tree shaking in general, and explore typical scenarios where code becomes un-tree-shakeable, as well as how these can be improved. I will show some concrete examples of the benefits of tree shaking, and of code I refactored to reduce the bundle size of applications drastically. I will also show how you can measure & test how tree shakeable your code is.

Related talks at this congress

Open session

World Congress 2024

July 19, 2024 · 13:20–13:30

Airstream (120)

How writing just one import the wrong way slows down your website

François Martin

Senior Full Stack Software Engineer at Karakun

François Martin
Open session

World Congress 2024

July 18, 2024 · 10:50–11:20

STAGE 5 (500)

Sleek, Swift, and Sustainable: Optimizations every web developer should consider

Andreas Taranetz

Holistic Developer & Tech Evangelist @Dynatrace

Andreas Taranetz
Open session

World Congress 2024

July 18, 2024 · 12:10–12:40

STAGE 10 (120)

Oh CommonJS! Why are you mESMing with me?

Jolo

Fullstack developer with a knack for whipping up code recipes using my secret ingredients: a dash of JavaScript, a pinch of Python, and a whole lot of serverless magic

Jolo
Open session

World Congress 2024

July 19, 2024 · 13:05–13:15

Airstream (120)

It's not only about the footprint

Carsten Windler

Principal Engineer @ Plan A

Carsten Windler
All sessions at this congress