Ctrip Mini‑Program Size Governance and Main Package Management Mechanism
This article details Ctrip's comprehensive mini‑program size governance framework, covering size allocation, detection, application approval, reminders, statistics, and main‑package file management to ensure packages stay within WeChat's limits and improve launch performance.
Background
WeChat, Alipay, and other mini‑program platforms limit the total package size to 20 MB and each sub‑package to 2 MB to guarantee a "instant‑open" experience. Ctrip's mini‑programs span over 30 business lines and hundreds of developers, and the package size was approaching the 20 MB ceiling, threatening launch speed and user experience.
Size Monitoring Mechanism
2.1 Size Allocation
Each business line (Bundle) receives a predefined quota composed of permanent size and temporary size. Permanent size is the inherent footprint of the Bundle, while temporary size can be reclaimed after a set date. The quotas are configured in the internal Mini‑Program Management Platform (see Fig. 2).
Example: the pages/train Bundle has 1888 KB permanent size + 155 KB temporary size. Developers must keep the permanent size within the limit before the temporary size expires.
2.2 Size Detection
When code is pushed to the release branch, the CI pipeline automatically measures the actual Bundle size. If the size exceeds the allocated quota, the build is aborted and a failure notification is sent to the relevant release group (see Fig. 3).
2.3 Size Application Approval
If a Bundle needs additional temporary size to ship new features, the Bundle Owner submits a request in the management platform. After committee review, the request may be approved. Converting temporary size to permanent size requires strong justification and agreed performance targets (see Fig. 4).
2.4 Size Reminder
Daily reminders are sent to Bundle Owners when any of the following conditions are met: the Bundle contains temporary size, the temporary size is about to expire, or the Bundle exceeds its size limit. Sample reminder messages are shown in Fig. 5‑6.
2.5 Size Statistics
The platform provides multi‑dimensional dashboards displaying size trends by BU, Bundle, and sub‑package, as well as size distribution across business lines (see Fig. 7‑8). These statistics help teams monitor usage and plan optimizations.
Main Package File Management Mechanism
The main package contains the default launch page, TabBar pages, and shared resources. Its size directly impacts first‑screen rendering performance.
3.1 Main Package File Management
The management platform offers a visual interface to view, add, or delete files in the main package (see Fig. 9). Configured files serve as a reference for subsequent checks.
3.2 Main Package File Check
During each pipeline build, files that may be bundled into the main package are extracted and compared against the configured list. Any unregistered file causes the build to fail and a notification is sent (see Fig. 10). After strict enforcement, the main package size decreased by 46.5% (Fig. 11) and stabilized, improving first‑screen load speed.
Conclusion
Ctrip's mini‑program size governance combines size allocation, detection, application, reminder, and statistics with rigorous main‑package management, effectively keeping the overall package within WeChat limits, enhancing launch performance, and providing a transparent view of size usage for future mini‑programs.
Ctrip Technology
Official Ctrip Technology account, sharing and discussing growth.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.