Bundle Size
ELI5 — The Vibe Check
How big your JavaScript file is after everything is smooshed together. Every npm package you install makes it bigger. That 'tiny' date library? 70KB. That 'lightweight' animation framework? 200KB. Before you know it, your users are downloading a megabyte of JavaScript just to see a landing page.
Real Talk
Bundle size is the total size of JavaScript (and CSS) files shipped to the browser after bundling, minification, and compression. Large bundles increase load times, especially on mobile networks. Tools like webpack-bundle-analyzer, bundlephobia, and import cost extensions help monitor and reduce bundle size.
Show Me The Code
# Check a package's size before installing
npx bundlephobia moment # 72.1KB minified
npx bundlephobia dayjs # 2.9KB minified
# Choose wisely 👀
When You'll Hear This
"Our bundle size is 3MB — users on 3G are suffering." / "Check bundlephobia before adding any dependency."
Related Terms
Code Splitting
Instead of sending the user one massive JavaScript file for your entire app, code splitting lets you break it into chunks and only send what's needed for t...
Lazy Loading
Lazy loading waits until you actually access related data before fetching it. Access post.author and only then does it query the database.
Minification
Minification is the full process of squishing your code files as small as possible before sending them to users.
Tree Shaking
Tree shaking is when your bundler looks at all the code you imported but never actually used, and throws it in the trash.