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.
tree-IT GmbH
Bad Neustadt an der Saale, Germany
€54-80K
Intermediate
Senior
Java
TypeScript
+1
Hubert Burda Media
München, Germany
€80-95K
Intermediate
Senior
JavaScript
Node.js
+1
MARKT-PILOT GmbH
Stuttgart, Germany
Remote
€75-90K
Senior
Java
TypeScript
+1
Matching moments
02:33 MIN
Why you might not need JavaScript for everything
WeAreDevelopers LIVE – You Don’t Need JavaScript, Modern CSS and More
08:07 MIN
Exploring modern JavaScript performance and new CSS features
WeAreDevelopers LIVE – AI, Freelancing, Keeping Up with Tech and More
03:16 MIN
Improving the developer feedback loop with specialized tools
Developer Time Is Valuable - Use the Right Tools - Kilian Valkhof
03:31 MIN
The value of progressive enhancement and semantic HTML
WeAreDevelopers LIVE – You Don’t Need JavaScript, Modern CSS and More
09:00 MIN
Navigating the growing complexity of modern CSS
WeAreDevelopers LIVE – You Don’t Need JavaScript, Modern CSS and More
11:10 MIN
The only frontend stack that truly matters
WeAreDevelopers LIVE – Frontend Inspirations, Web Standards and more
02:49 MIN
Using AI to overcome challenges in systems programming
AI in the Open and in Browsers - Tarek Ziadé
09:38 MIN
Technical challenges of shipping a cross-platform browser
Developer Time Is Valuable - Use the Right Tools - Kilian Valkhof
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
Catching up on the basics you don't really need that much code
Chris Heilmann
How a Small Team Shrank a Microsoft Monorepo by 94%
Jonathan Creamer
Things I learned while writing high-performance JavaScript applications
Michele Riva
Related Articles
View all articles



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

Visonum GmbH
Remote
Junior
Intermediate
React
Redux
TypeScript

Confideck GmbH
Vienna, Austria
Remote
Intermediate
Senior
Node.js
MongoDB
TypeScript


TechBiz Global GmbH
REST
Docker
Node.js
JavaScript
Continuous Integration

SHAPE IT
Canton de Lille-5, France
€38-48K
Intermediate
DevOps
Python
NestJS
Agile Methodologies

Optimus Search
Berlin, Germany
Remote
Intermediate
API
CSS
GIT
React
+4



Vizzuality
Carballedo, Spain
Remote
€30-49K
Node.js
TypeScript