Bundle Size
What Expressive costs your bundle, measured per import shape
Every import-shape figure on this page is measured when the site is built: .github/scripts/bundle-size.ts bundles the built packages and gzips the result, so the numbers cannot drift from the code they describe.
What it costs
Minified, then gzipped. React is a peer dependency and excluded, as it would already be in your app.
| What you import | gzip |
|---|---|
@expressive/mvc — Model only (headless) | ~7.4 kB |
@expressive/mvc — every export | ~11.5 kB |
@expressive/react — Model only | ~11.9 kB |
@expressive/react — Model, Component, instructions | ~12.9 kB |
@expressive/react — the above plus has and map collections | ~13.6 kB |
@expressive/react — every export | ~14.7 kB |
@expressive/mvc + @expressive/dom — renderer without style helpers | ~23.7 kB |
@expressive/mvc + @expressive/dom — every export, including styling | ~28.8 kB |
@expressive/router — every export | ~15.0 kB |
@expressive/react + @expressive/router | ~17.9 kB |
A typical React app lands around ~12.9 kB. There are no runtime dependencies, so that is the whole cost — nothing else arrives behind it.
Methodology, and why the numbers differ elsewhere
Bundle size has no single definition, and the three common ones differ by more than the numbers above:
- gzip of an import shape — what this page reports, and what actually reaches your users.
- Unminified and gzipped — larger, because comments survive; 18-42% of our shipped JavaScript is documentation comments, which minification removes. Reporting this number would overstate the cost roughly twofold.
- npm install size — much larger again (
@expressive/mvcunpacks to ~340 kB), because the published tarball carries type declarations and source maps. Those never enter a browser bundle.
If a third-party size service quotes something different from this table, the measurement is probably one of the other two.
Tree-shaking
The headless core shakes properly: importing only Model costs ~7.4 kB against ~11.5 kB for everything, so unused instructions genuinely do not ship. It is built unbundled — one module per source file, sideEffects: false — and its module-level work only touches classes the same module exports, which is what makes that declaration safe.
The appearance system is likewise optional: renderer imports measure ~23.7 kB; adding style and Style raises the total to ~28.8 kB. The renderer retains only the small token protocol needed to accept styles registered elsewhere. Unlike the React rows, these figures include @expressive/mvc, which @expressive/dom does not re-export and an app therefore imports directly.
The React adapter has a floor you cannot shake below: ~11.9 kB, reached by importing it at all. That is deliberate and worth being plain about. The adapter works by patching types it does not own, at import time:
Component.prototype.$$typeof, so an instance can be placed directly as JSXComponent.contextType, wiring the class into React contextisReactComponent, so React treats it as a class component- the host runtime registry, which hands the core its renderer
Cross-package prototype patches cannot be tree-shaken away without breaking the library, so the wiring arrives whole or not at all. Above the floor, shaking resumes normally. has and map are the clearest case: each declares itself renderable to the core as it loads, exactly as Component does, and the adapter adopts every declared class with the same element seam, so the patch that lets a pool or map render as an element travels with the collection module itself - an app that imports has pays for it (~0.6 kB together with map), an app that never does ships neither. pending and the rest of the core drop out the same way.
The practical consequence: Expressive rewards using more of what you have already paid for, and is a poor fit for shipping one tiny piece of it into an otherwise dependency-free bundle.
How growth is caught
Each import shape is measured separately rather than as one total — the point is to notice when the adapter floor grows, or when a formerly shakeable export stops shaking, neither of which a total would reveal. Every pull request measures each shape against its base branch and lists the difference in its checks. A shape that grows more than 5% in one change fails the check: ordinary feature growth stays well under that, while lost tree-shaking does not. The check is advisory — intended growth is explained in the pull request and merged.