Skip to main content

Webpack Bundle Size Estimator

Estimate your JavaScript bundle size before you build. Add npm packages, toggle tree-shaking and partial imports, and see total gzipped weight with load time estimates across network speeds.

✓ Real bundlephobia data ✓ Tree-shaking estimation ✓ Network load time preview ✓ Quick presets (React, Vue, etc.)

Frequently Asked Questions

How accurate are these bundle size estimates?▼

Sizes come from bundlephobia.com which measures the actual minified + gzipped output for each package. The tree-shaking and partial import savings are approximations (40% and 70% reduction respectively) — actual savings depend on your webpack/rollup config, which parts you import, and whether the library is written as ESM. Use these as planning estimates, not exact figures.

What is tree-shaking and does it work for all packages?▼

Tree-shaking is dead-code elimination — your bundler removes exports you never import. It only works on ESM (ES Modules) packages with a module field in package.json. Packages like moment, jquery, and most CJS-only packages cannot be tree-shaken. Lodash-es (the ESM version of lodash) is fully tree-shakeable; lodash (CJS) is not.

What does 'partial import' mean in this tool?▼

Partial import means you only import specific functions, not the entire library. For example, import format from 'date-fns/format' instead of import { format } from 'date-fns'. This is especially effective for large utility libraries like lodash, date-fns, and Material UI where you may only use 5-10% of the API surface.

How should I interpret the load time estimates?▼

These estimates assume the JS must be downloaded from scratch (no cache). Real-world load time depends on CDN caching (repeat visitors get cached bundles), HTTP/2 multiplexing, and how the JS is chunked. Focus on the 3G estimate as a worst-case mobile scenario — if it is over 5 seconds, consider code-splitting.

What is webpack-bundle-analyzer and how do I use it?▼

webpack-bundle-analyzer generates a visual treemap of your actual bundle. Install it: npm install --save-dev webpack-bundle-analyzer. Add to webpack.config.js: const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin. Then add new BundleAnalyzerPlugin() to your plugins array. Run webpack to open the visual report showing exactly which packages take the most space.

How do I reduce my JavaScript bundle size?▼

1. Code-split with dynamic import() so each route only loads what it needs. 2. Replace heavy libraries with lightweight alternatives (moment→dayjs, lodash→lodash-es, MUI→shadcn/radix). 3. Use partial imports for utility libraries. 4. Enable tree-shaking (ESM-only packages). 5. Use a CDN for large stable dependencies. 6. Audit with webpack-bundle-analyzer to find duplicate packages.

Share this tool: X / Twitter LinkedIn
✓ 60,000+ developers use DevPlaybook ★★★★★ 4.8 / 5 on Gumroad ✓ MIT licensed · Instant download ✓ No login required

Related Products

on Gumroad

You Might Also Need

More Free Tools

Enjoying this tool? Get more like it.

Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.

DevPlaybook Pro 7 days free

Unlock AI-Powered Dev Tools

  • ⚡ AI Code Review, Doc Generator & SQL Builder
  • ⚡ All premium templates & early access
  • ⚡ Member discounts on Gumroad products
Start Free Trial →

$9/mo after trial · Cancel anytime

Want the full toolkit?

Get DevPlaybook Pro

Every template, guide, boilerplate, and automation script in one bundle. 13 premium products — grab them all at once and save big.

$79
$241 separately Save $162 (67% off)
Get DevPlaybook Pro — $79 →

MIT licensed · Instant download · No subscription

See what's included → Browse all deals →