uniapp-subpackages
Skill0 starsChanged 18 days agoMITView on GitHub
uni-app 小程序分包与包体积优化。主包超过 2MB、新增业务模块、配置 pages.json subPackages / preloadRule 时使用。
In this repository11 other files it gives its agents.
- pinia-storeSkill
- release-checklistSkill
- uniapp-cross-platformSkill
- uniapp-loginSkill
- uniapp-paymentSkill
- uniapp-performanceSkill
- uniapp-permissionsSkill
- uniapp-project-structureSkill
- uniapp-requestSkill
- uniapp-ui-libsSkill
- vue3-compositionSkill
The file
Files
分包与包体积
- 微信小程序:主包 ≤ 2MB,总包 ≤ 20MB(以官方当前限制为准)。
- 主包只放:tabBar 页、登录页、公共组件、核心 utils;其余业务按模块分包。
{
"pages": [{ "path": "pages/index/index" }, { "path": "pages/mine/mine" }],
"subPackages": [
{ "root": "pkg-order", "pages": [{ "path": "list/list" }, { "path": "detail/detail" }] },
{ "root": "pkg-user", "pages": [{ "path": "setting/setting" }] }
],
"preloadRule": { "pages/index/index": { "network": "all", "packages": ["pkg-order"] } }
}- manifest.json →
mp-weixin.optimization.subPackages: true,让只被分包引用的组件/JS 打进分包。 - 分包内页面跳转路径写全:
/pkg-order/detail/detail?id=1。 - 分包不能引用其他分包的资源;公共资源放主包。
- 检查体积:微信开发者工具 → 详情 → 代码依赖分析;去掉未用的 uView/echarts 全量引入(echarts 用自定义构建或 uCharts)。
- 静态图片 > 50KB 一律上 CDN。
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

