优化微信小程序超包问题

分包

在这里插入图片描述

{
	"easycom": {
		"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
	},
	"pages": [
		//pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
		// 首页
		{
			"path": "pages/user/home",
			"style": {
				"navigationBarTitleText": "",
				"enablePullDownRefresh": false
			}
		},
		// 登录页
		{
			"path": "pages/login/index",
			"style": {
				"navigationBarTitleText": "",
				"enablePullDownRefresh": false
			}
		},
	],
	"style": "v2",
	"sitemapLocation": "sitemap.json",
	"subPackages": [{
			"root": "pages/fenbao1/",
			"pages": [
				{
					"path": "demand",
					"style": {
						"navigationBarTitleText": "",
						"enablePullDownRefresh": true
					}
				},
				{
					"path": "recyclingList",
					"style": {
						"navigationBarTitleText": "",
						"enablePullDownRefresh": false
					}
				},
			]
		},
		{
			"root": "pages/fenbao2/",
			"pages": [
				{
					"path": "searchCustomer",
					"style": {
						"navigationBarTitleText": "查询客户信息",
						"enablePullDownRefresh": true
					}
				}
			]
		},
		{
			"root": "pages/newDemand/",
			"pages": [{
					"path": "demand_menu",
					"style": {
						"navigationBarTitleText": "回收需求管理",
						// "navigationBarBackgroundColor": "#fffff",
						"enablePullDownRefresh": false
					}
				},
			]
		}
	],
	"tabBar": {
		"backgroundColor": "#ffffff",
		"borderStyle": "black",
		"selectedColor": "#3C9CFF",
		"color": "#666666",
		"list": [{
				"pagePath": "pages/user/home",
				"iconPath": "/static/tabBar/home.png",
				"selectedIconPath": "/static/tabBar/home-default.png",
				"text": "首页"
			},
			{
				"pagePath": "pages/user/user",
				"iconPath": "/static/tabBar/user.png",
				"selectedIconPath": "/static/tabBar/user-default.png",
				"text": "我的"
			}
		]
	},
	"globalStyle": {
		"navigationBarTextStyle": "black",
		"navigationBarTitleText": "uni-app",
		"navigationBarBackgroundColor": "#F8F8F8",
		"backgroundColor": "#F8F8F8"
	},
	"condition": { //模式配置,仅开发期间生效
		"current": 0, //当前激活的模式(list 的索引项)
		"list": [{
			"name": "", //模式名称
			"path": "", //启动页面,必选
			"query": "" //启动参数,在页面的onLoad函数里面得到
		}]
	}
}

1、如果分包后主包还是超了可以把图片放在云服务上,把主包文件夹中一些大的js或者json等的文件移到子包中

2、在hbuilderx中的运行 -> 运行到小程序模拟器 -> 运行时是否压缩代码,勾选

3、微信小程序模拟器中的本地设置把压缩的都勾选

在这里插入图片描述

  • 3
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值