Your Design System Is Drowning in Dead Code: A Design-Token Love Story
By The bee2.io Engineering Team at bee2.io LLC

You know what's wild? A major productivity platform recently shipped 2.3 megabytes of JavaScript to render a blog post. Two point three. That's roughly equivalent to emailing someone a PDF of your entire kitchen renovation plans when they just asked what time dinner is. And yet somehow, marketing still wonders why the page takes twelve seconds to load.
Here's the thing nobody wants to admit: the JavaScript bundle size problem isn't actually a JavaScript problem. It's a design system problem wearing a JavaScript costume.
The Shared Component Tragedy Nobody Talks About
Every organization has a design system. Some of them are intentional. Most are accidents that happened slowly over three years. What they all have in common is this: someone built a dropdown component in 2019, and it's now in literally seventeen different product surfaces, each one modified slightly because "our use case is special."
Those seventeen variations? They're all shipping to every user, every time. That's not a code splitting problem. That's an architecture problem wearing a JavaScript hat.
Here's what research tells us: enterprises lose an average of 35-40% of their bundle size to components that never get used on the current page. Not because the components are badly written. Because nobody documented which components live where, so developers default to "just import everything to be safe." This is the web development equivalent of taking every tool in your garage to fix a light bulb because you can't remember which socket wrench does what.
The solution isn't fancy tree shaking or dynamic imports (though we'll get to those). The solution is knowing what you actually have. When your design tokens and component library are properly integrated, everyone building anything knows exactly which component to grab and which one they don't need. Fewer decisions means fewer mistakes. Fewer mistakes means smaller bundles.
Design Tokens: The Unglamorous Hero Nobody Notices Until It's Gone
A design token is just a fancy way of saying "here's what a button looks like." Colors, spacing, typography, shadows-the stuff designers actually care about and engineers copy-paste from Figma links at 4 PM on Friday.
When design tokens live in one central place-properly integrated with your component library-something magical happens: you stop shipping duplicate style definitions. One major SaaS platform we know about literally had color definitions in seven different JavaScript files. Same colors. Seven files. They weren't malicious about it. It just happened because communication between design and engineering was basically two people yelling at each other across a parking lot.
Proper design system integration means your tokens feed into your components, which feed into your build pipeline. Every product surface uses the same definitions. Update a token in one place, and it cascades everywhere. No more blue-primary-button.js and button-blue-v2.js living in different repos. Your bundle shrinks. Your UI consistency improves. Your engineers stop having heated debates about whether a margin should be 12px or 16px at 3 AM on a Tuesday.
Code Splitting and Dynamic Imports: The Actual Tools That Matter (Now That You Have a System)
Once your design system is actually integrated, code splitting and dynamic imports become useful instead of just feeling like busywork.
Tree shaking removes dead code at build time. Dynamic imports load modules only when needed. Code splitting breaks your bundle into chunks so users only download what they're actually using. These are real, valuable techniques. But they only work if you have a design system that's actually, you know, systematic. If your components are chaos, all the clever webpack configuration in the world won't save you.
The playbook: audit your shared components to see what's actually used on each page. Consolidate those seventeen dropdown variants into one dropdown with documented options. Define your design tokens once. Then-and only then-implement code splitting with confidence, knowing that your bundle reflects actual usage, not cargo cult imports.
Want to know if your site has this problem? SCOUTb2 can scan your JavaScript payloads and show you the unused components bleeding through your design system. Spoiler alert: you probably have more than you think. Then the real work begins-not in the build tools, but in making your design system something people actually want to use.
Disclaimer: This article is for informational purposes only and does not constitute legal, professional, or compliance advice. SCOUTb2 is an automated scanning tool that helps identify common issues but does not guarantee full compliance with any standard or regulation.
Stop finding issues manually
SCOUTb2 scans your entire site for accessibility, performance, and SEO problems automatically.