question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: Worker is not a function

See original GitHub issue

I’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:open
  • Created 3 years ago
  • Reactions:5
  • Comments:8

github_iconTop GitHub Comments

5reactions
GarrisonDcommented, Sep 19, 2020

@GlenHughes I had the same issue. Do you have worker-loader of version 3.0 or higher in package-lock.json? I had and after removing worker-loader & reinstalling (it’s important to uninstall and install again!!!)comlink-loader this issue disappeared.

2reactions
GarrisonDcommented, Nov 25, 2020

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found