andywer / andywer/threads.js

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'registerSerializer')

オープン
#407 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
TypeScript
スター
3.5k
フォーク
173
PR マージ指標
30日以内にマージされた PR はありません

説明

Hi everyone,
I have a problem with quasar framework and thread.js and I don't know how to solve the following error: **"Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'registerSerializer')"**

How reproduce this error:
`create quasar project` (with typescript support)
`npm install threads tiny-worker`
`npm install -D threads-plugin`

Then into your quasar.config.js:
`const ThreadsPlugin = require('threads-plugin');`

and extend webpack in build section:
`extendWebpack (cfg) {
cfg.plugins.push(new ThreadsPlugin())
}`

Finally tried the following code from thread.js documentation in typescript section:
```
//App.vue


import { spawn, Thread, Worker } from "threads"
import { Counter } from "./workers/counter"

export default {
setup(){
const counter = await spawn<Counter>(new Worker("./workers/counter"))
await counter.increment()
await Thread.terminate(counter)

return {}
}

```

```
//workers/counter.ts
import { expose } from "threads/worker"

let currentCount = 0

const counter = {
getCount() {
return currentCount
},
increment() {
return ++currentCount
},
decrement() {
return --currentCount
}
}

export type Counter = typeof counter

expose(counter)
```

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。