收藏
回答

为什么小程序分包之后,加载更慢了?

官方同学,你好。

最近开发小程序有3个问题,能不能帮忙解答一下。

1、小程序分包之后,为什么“下载阶段”更慢了。

        测试机:ip8p ip6p 华为p30  

        结果:和分包之前没啥区别,甚至更慢。

2、未分包的小程序,运行中为啥会有2个wxapkg包,而分包只有一个。

        测试机:华为mate20

分包前(ip8p):


分包后(ip8p):



分包后的app.json

"pages": [
        "pages/home/channel/channel",
        "pages/home/shelf/shelf",
        "pages/home/find/find",
        "pages/home/tem_channel/tem_channel"       
    ],
    "subPackages":[
        {
            "root": "pagesBook",
            "name": "pkgBook",
            "pages": [
                "detail/detail",
                "publisher/publisher",
                "prize/prize",
                "book_list/book_list",
                "share_detail/share_detail",
                "share_result/share_result",
                "given_list/given_list",
                "series_book/series_book",
                "list/list"
            ]
          }, {
            "root": "pagesUser",
            "name": "pkgUser",
            "pages": [
                "phone/phone",
                "new_user/new_user",
                "buy_book/buy_book",
                "trade_record/trade_record",
                "autoBuy/autoBuy",
                "center/center",
                "account/account",
                "auth_login/auth_login"
            ]
          },{
            "root": "pagesRank",
            "name": "pkgRank",
            "pages": [
                "rank/rank",
                "rank_channel/rank_channel"
            ]
          },{
            "root": "pagesPay",
            "name": "pkgPay",
            "pages": [
                "pay/pay",
                "pay_null/pay_null",
                "pay_result/pay_result",
                "recharge/recharge"
            ]
          },{
            "root": "pagesOther",
            "name": "pkgOther",
            "pages": [
                "guide_down/index",
                "category_detail/category_detail",
                "exchange/week_read/week_read",
                "search/index",
                "category/category",
                "catalog/catalog",
                "read/index",
                "series/index",
                "diary/info/info",
                "welfare/info/info",
                "program/detail/detail",
                "principals/detail/detail",
                "null_webview/index",
                "currency/currency"
            ]
          }
    ],
    "preloadRule":{
        "pages/home/channel/channel":{
            "network": "all",
            "packages": ["pkgBook","pagesRank","pagesOther"]
        },
        "pages/home/find/find":{
            "network": "all",
            "packages": ["pkgBook","pagesOther"]
        },
        "pages/home/shelf/shelf":{
            "network": "all",
            "packages": ["pkgUser"]
        },
        "pagesBook/detail/detail":{
            "network": "all",
            "packages": ["pagesOther"]
        }
    },



回答关注问题邀请回答
收藏

1 个回答

  • 疯狂的小辣椒
    疯狂的小辣椒
    2019-12-02

    你好,麻烦提供下小程序的appid,复现时也在手机微信那里上传下日志: 我->设置->帮助与反馈右上角有个上报日志的入口,麻烦提供一下微信号,时间点

    2019-12-02
    有用
    回复
登录 后发表内容
问题标签