alewin/useWorker

How can I use api calls in useWorker?

KbnCodes opened this issue · 1 comments

[Required] Describe the bug
I need to get data from backend and store that large amount of data to indexeddb , But issue is when iam using axios or fetch iam getting error , is there any other option to invoke api calls ?

"Uncaught ReferenceError: axios__WEBPACK_IMPORTED_MODULE_2___default is not defined" --- this error getting when using axios ,

[Required] Expected behavior
is there any inbuild method to call api ? ot any way to import third party library like axios

[Optional] Screenshots

[Optional] Device (please complete the following information):

  • OS: [Windows]
  • Browser [chrome]

[Optional] context
Add any other context about the problem here.

remoteDependencies,以及不要直接使用 import 导入的变量名

参考: https://github.com/CroatiaParanoia/tortoise/blob/master/src/App.tsx#L7

如上可以解决你的问题(至少我的 SparkMD5 可以正常使用)

另外如果有更好的实现,可以告知我一下, 不甚感激