TypeError: Worker is not a function
See original GitHub issueI’m trying to implement comlink into a project. I’m currently getting a TypeError: Worker is not a function
error thrown in the console but the code compiles fine without any warnings or errors.
“comlink”: “^4.3.0” “comlink-loader”: “^2.0.0”
How I’m using comlink-loader:
import MyWorker from "comlink-loader!./assets/worker.js"
const worker = new MyWorker()
I also want to inline the workers so they are included within the webpack generated bundle. Is this possible?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:5
- Comments:8
Top Results From Across the Web
worker.recognize(...).progress is not a function. How to fix?
I think the issue is that the code is out of date. Try this async function getTextFromImage() { await worker.load() await worker.
Read more >Resolving TypeError: "X" is Not a Constructor in JavaScript
JavaScript "TypeError: "x" is not a constructor" errors occur when invalid objects or a variable is erroneously used as a constructor.
Read more >TypeError: "x" is not a function - JavaScript - MDN Web Docs
The JavaScript exception "is not a function" occurs when there was an attempt to call a value from a function, but the value...
Read more >TypeError: "X" is not a constructor in JavaScript [Solved]
Note that arrow functions cannot be used as constructors. ... const obj = {}; // ⛔️ TypeError: obj is not a constructor const...
Read more >jest-worker - npm
If it is not provided, it will be obtained by requiring the child ... import {Worker as JestWorker} from 'jest-worker'; async function ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@GlenHughes I had the same issue. Do you have
worker-loader
of version3.0
or higher inpackage-lock.json
? I had and after removingworker-loader
& reinstalling (it’s important to uninstall and install again!!!)comlink-loader
this issue disappeared.@outlawpractice that would be cool to upgrade the worker loader to the latest version. I am not sure if I can do it. Will see.