developit / developit/workerize-loader

Failed to execute 'postMessage' on 'DedicatedWorkerGlobalScope': function transformRequest(data, headers) { normalizeHeaderName(headers, 'Accept'); normalizeHeaderName(...<omitted>... } could not be cloned.

未關閉
#121 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
JavaScript
星號
2.3k
分支
85
PR 合併指標
30 天內沒有已合併 PR

描述

I query a large Firebase collection in my app.
I'd like to use `axios` in my app. But it is wrong

`
// worker.js

import axios from "axios";
import 'regenerator-runtime';

export async function expensive() {
const res = await axios.get('https://vdata.amap.com/tiles?mapType=normal&v=3&style=5&key=f97efc35164149d0c0f299e7a8adb3d2&version=1.4.17&rd=2&flds=roadlabel,poilabel&t=9,432,204;9,436,204;9,432,201;9,436,201;9,432,203;9,436,203;9,433,204;9,435,204;9,432,202;9,436,202&lv=9&key=f97efc35164149d0c0f299e7a8adb3d2&preload=0');
console.log(res)
return res;
}
`
When I run the worker as follows:

// app.js
import Worker from 'workerize-loader!./worker';

`
let instance = worker()

instance.expensive().then(data => {
console.log(`${data}`)
})
`

Failed to execute 'postMessage' on 'DedicatedWorkerGlobalScope': function transformRequest(data, headers) { normalizeHeaderName(headers, 'Accept'); normalizeHeaderName(...... } could not be cloned.

Is it a bug in workerize or is it me doing something wrong?

貢獻指南

這個儲存庫沒有索引到貢獻指南

研究方向

先從 worker.js 和 app.js 範例開始,接著檢查 workerize-loader!./worker 進入點及其訊息傳遞路徑。使用所示的 axios 請求重現 expensive(),並追蹤回傳值經過 postMessage 的流程;完成的標準是 worker 呼叫不再產生所回報的 structured-clone error。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
javascript, webpack
領域
tooling, web-dev
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。