Francesco Novy
Tree Shaking the Bytes Away
#1about 2 minutes
Understanding tree shaking to remove unused code
Tree shaking is a process used by bundlers to automatically remove unused code, also known as dead code, from your final application build.
#2about 4 minutes
How bundlers work and why they are necessary
Bundlers are essential for optimizing browser applications by combining code into a single file and enabling tree shaking, unlike native browser imports which load entire modules.
#3about 4 minutes
How static analysis enables code removal
Bundlers use static analysis at build time to create a dependency graph and identify unused code, but they cannot account for dynamic, runtime conditions.
#4about 3 minutes
How to test and measure tree shaking effectiveness
Use the `size-limit` NPM package to create test scenarios that measure bundle size impact and integrate these checks into CI to prevent regressions.
#5about 5 minutes
Using composition over options for better tree shaking
Refactor code from an options-based approach to a composition pattern to ensure optional features and their dependencies can be completely tree-shaken away.
#6about 4 minutes
Using static build flags for build-time optimization
Implement magic strings that are replaced with boolean values at build time, allowing the bundler to remove entire code blocks like debug logs for production builds.
#7about 4 minutes
Q&A on barrel files and build environment differences
The Q&A covers how barrel files can complicate tree shaking and the potential risks of having different development and production builds due to build-time flags.
Related jobs
Jobs that call for the skills explored in this talk.
Matching moments
01:27 MIN
Understanding tree shaking and dead code elimination
A Practical Guide to Reducing Bundle Size
03:05 MIN
Executing JavaScript and optimizing the bundle
The Journey of a Pixel in a React Application
04:21 MIN
Reducing JavaScript's impact with smaller bundles
Sustainable me. A tale of good design.
03:06 MIN
Reducing bundle size by replacing heavy dependencies
Challenges of building React and React Native apps
05:01 MIN
How production builds remain highly optimized
The Eternal Sunshine of the Zero Build Pipeline
02:11 MIN
The importance of testing your bundle size
A Practical Guide to Reducing Bundle Size
01:39 MIN
How bundling reveals ESM's performance advantage
Oh CommonJS! Why are you mESMing with me?
01:57 MIN
The two primary approaches for improving frontend performance
To New Frontiers: The Future of Frontend Development
Featured Partners
Related Videos
A Practical Guide to Reducing Bundle Size
Stephen Cooper
The Eternal Sunshine of the Zero Build Pipeline
M4dz
How Your Bundle Size Affects The Climate
Roy Derks
The Lean Web
Chris Ferdinandi
Let's build a VS Code extension for automated refactorings
Nicolas Carlo
Why I Recommend Svelte to Every New Web Developer
Markus Hatvan
1, 2, 3... Fastify!
Matteo Collina
Destructuring Frontend monoliths with MicroFrontends
Trishul Goel
Related Articles
View all articles



From learning to earning
Jobs that call for the skills explored in this talk.

doinstruct Software GmbH
Berlin, Germany
Senior
GIT
JavaScript
TypeScript

Speech Processing Solutions
Vienna, Austria
Intermediate
CSS
HTML
JavaScript
TypeScript

Saby New Compy
Bielefeld, Germany
Intermediate
Java
Kotlin

autoiXpert GmbH & Co. KG
Stuttgart, Germany
Senior
Node.js
Angular
MongoDB
TypeScript


Lotum media GmbH
Bad Nauheim, Germany
Senior
Node.js
JavaScript
TypeScript

JO Media Software Solutions GmBh
Brunn am Gebirge, Austria
Senior
CSS
Angular
JavaScript
TypeScript

