版本:2.3.4
微信社區:如何解決warning:可能無法在真機上讀取js/json/wxml/wxss 文件路徑?
微信社區:報錯:js/json/wxml/wxss 文件路徑在真機上可能無法讀取?
使用微信開發者工具1.03版本,發布微信小游戲報錯,原因未知,不只是提示warn信息,在預覽時,真的找不到這個json。
把微信小游戲開發工具從1.03退到1.02,雖然有提示warn,但是能夠正常上傳預覽了。
水友提供,在game.js里添加如下代碼,則提示信息不顯示
console.warnCustom = console.warn; console.warn =function(res){ if(typeof res =="string"&&res.indexOf("文件路徑在真機上可能無法讀取")>-1 ){ return; }else{ console.warnCustom(res) } } console.groupCustom = console.group; console.group =function(res){ if(typeof res =="string"&&res.indexOf("讀取文件/文件夾警告")>-1 ){ return; }else{ console.groupCustom(res) } }