Developers treat the mini-program package cap — around 2 MB for the main package — as a straitjacket. It's the most useful constraint the platform ever handed you. It forces the two things that make a mini-program fast: a shared runtime you don't ship, and a small bundle you actually do. The ceiling isn't the limit on what you can build. It's the reason your first screen stays fast.

The cap is doing you a favor

On the open web a bundle can bloat to 5, 10, 20 MB and nobody stops you. The result is a generation of apps that take seven seconds to become useful. A mini-program that physically cannot exceed 2 MB for its main package can't hide that bloat. The constraint is a code review you didn't have to run.

And with a host-owned runtime, the engine isn't in your package at all. The 2 MB is your code, your business assets, your logic — not a JavaScript framework and a rendering engine you re-ship on every open. That changes what "2 MB" means. It's room for your product, not your plumbing.

What actually eats the budget

  • The framework itself. If you bundle your own runtime, you've spent the cap before writing a feature. Let the host provide it.
  • A UI kit you use at 5%. Importing a component library for three buttons is the classic silent tax. Import the buttons, not the library.
  • Images in the package. Ship them from a CDN, not the bundle. Every KB of image is a KB of cold-start delay.
  • Big JSON at startup. Level data, config, catalogs — fetch them at runtime, don't pack them.

Discipline beats cleverness

The teams that ship fast mini-programs aren't smarter. They're bounded. They code-split by route, lazy-load what isn't on the first screen, and treat the package like a carry-on: if it doesn't need to be there on open, it doesn't go. That discipline produces a first screen that downloads in a blink, which is the whole point of a mini-program.

ItemNaive bundleDisciplined bundle
RuntimeBundled (1.5 MB)Host-provided (0)
UI kitWhole libraryThree components
ImagesIn packageCDN
Config / dataPacked JSONFetched at runtime
Main package~2.4 MB (over cap)~300 KB

The tradeoff you accept

Subpackages and CDN assets add moving parts. A split bundle means more requests; a CDN means the first paint waits on the network for assets. Neither is free, and a careless split trades one bottleneck for several. The honest version is that the cap forces you to think about weight — and thinking about weight is what separates a mini-program that opens instantly from one that doesn't.

The real read

Stop framing the 2 MB ceiling as something to fight. It's the platform doing the architectural nagging for you. With a shared runtime under the hood, that ceiling is generous: it's all product, no engine. Spend it on the experience, not the scaffolding, and the cap stops being a limit and starts being why your mini-program feels lighter than the app it replaced.

Sources