跳到主要內容

發表文章

目前顯示的是 10月, 2024的文章

iphone chrome 遠程偵錯 cocos h5

要在 windows 下偵錯 cocos h5 跟 mac 不一樣 首先安裝weinre $ npm install -g weinre 啟動weinre $ weinre --boundHost 192.168.3.162 --httpPort 9091 查看remote debug, 開啟這個頁面 http://192.168.3.162:9091/client/ iphone chrome的基本信息 element也可以查看 network 如下 查看console輸出 這樣在手機上要找問題就方便多了 cocos打包h5版本之後, 在輸出的 web-mobile/index.html 檔案新增以下內容 <script src="http://192.168.3.162:9091/target/target-script-min.js"></script> 手機端瀏覽運行 http://192.168.3.162/alnair/build/web-mobile/, 回到console後可以看到 weinre 有連接近來 後台也可以看到對應的連接跟log

縮減_virtual_cc檔案大小

  目前打包出來的資源中 cocos-js 大小在 3.79 MB 上下 關閉某些cocos中不需要的功能 可以縮減 _virtual_cc 的大小 Note. No deprecated APIs 打開後 XMLHttpRequest 調用會出錯, 被縮減掉了, 後續還是打開

cloud storage 設定 cors 配置

將資源放在 cloud storage 時, 前端拉取圖片出現 cors 問題, 以下則是設定 cloud storage cors 配置流程 切換到 cloud storage, 選擇要增加cors的值區進入後開啟 cloud shell 點...選擇上傳, 將配置檔案上傳 上傳配置檔案 google_cloud_storage_cors.json [     {       "origin": ["*"],       "responseHeader": ["Content-Type"],       "method": ["GET", "HEAD", "DELETE"],       "maxAgeSeconds": 3600     } ]  //查詢目前配置 $ gcloud storage buckets describe gs://grd-ab --format="default(cors_config)" //套用上傳配置 $ gcloud storage buckets update gs://grd-ab --cors-file=google_cloud_storage_cors.json https://cloud.google.com/storage/docs/using-cors?hl=zh-cn#command-line