部分线上用户,出现加载分包失败,提示 {"errMsg":"loadSubpackage:fail module not found"}
以下为统计的3台设备信息:
{"SDKVersion":"3.3.2","sysinfo":"{\"platform\":\"android\",\"brand\":\"HUAWEI\",\"model\":\"SEA-AL10\",\"pixelRatio\":3,\"system\":\"Android 10\",\"version\":\"8.0.45\",\"screenWidth\":780,\"screenHeight\":360,\"language\":\"zh_CN\",\"benchmarkLevel\":24}"}
{"SDKVersion":"3.3.2","sysinfo":"{\"platform\":\"android\",\"brand\":\"HUAWEI\",\"model\":\"ANA-AN00\",\"pixelRatio\":3,\"system\":\"Android 12\",\"version\":\"8.0.45\",\"screenWidth\":780,\"screenHeight\":360,\"language\":\"zh_CN\",\"benchmarkLevel\":26}"}
{"SDKVersion":"3.3.2","sysinfo":"{\"platform\":\"android\",\"brand\":\"HUAWEI\",\"model\":\"VOG-AL00\",\"pixelRatio\":3,\"system\":\"Android 10\",\"version\":\"8.0.45\",\"screenWidth\":780,\"screenHeight\":360,\"language\":\"zh_CN\",\"benchmarkLevel\":24}"}
代码如下:
public static openSubpackage(name:string, fun:(stat:number, msg?:any) => void, progressFun?:Function){
if (window["wx"] && wx.loadSubpackage) {
let start = Date.now();
let task = wx.loadSubpackage({
name: name,
success: function () {
let cost = (Date.now()-start);
fun && fun(1, cost);
},
fail: function(res) {
fun && fun(2, res);
}
});
if(!task){
console.warn("openSubpackage-fail:", name);
return fun && fun(2);
}
task.onProgressUpdate(res => {
if(progressFun){
progressFun(res.progress, res);
}
})
}
else {
window["require"]("./" + name + "/game.js");
fun && fun(1);
}
}
请提供代码片段或者请直接点击链接咨询“小助手”:https://work.weixin.qq.com/kfid/kfcca4feec277f91616