-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem when using mediapipes from inside a worker loaded as a module #5257
Comments
Hi @martenrichter, Could you please confirm whether the issue has been resolved on your end, or if you still require assistance from our end? Thank you!! |
Well, yes and no. So, the problem persists, and I think a fix would benefit other users. (Of course, I will be happy to help.) |
Hi @martenrichter, Thank you for confirming. I will bring this to the attention of our team. Please allow us some time, and we will update you through the same thread once we have any further information available. |
Hi @kuaashish, |
any update on this , |
We can try to apply your patch but our build pipeline is pretty complicated due to how our internal JS compiler is set up. While the external build should be fully functional, we are using a Google-internal compiler to further reduce our binary size. |
The changes to the compilation were just necessary so that |
Hi, any progress on this? Any workarounds? Thanks! |
You can use the fork in my PR and compile it yourself. |
Have I written custom code (as opposed to using a stock example script provided in MediaPipe)
None
OS Platform and Distribution
Web
MediaPipe Tasks SDK version
master branch
Task name (e.g. Image classification, Gesture recognition etc.)
Image classification but should apply to all tasks
Programming Language and version (e.g. C++, Python, Java)
Javascript
Describe the actual behavior
When loading the code I get an importScript exception
Describe the expected behaviour
That it also works from workers loaded as module
Standalone code/steps you may have used to try to get what you need
If your worker is loaded as a worker, e.g.:
You will get an error saying that importScripts is not supported.
Note, as framework with bundlers such as vite, convert you commonJS module to ESM module, converting the worker to commonJS is not an option.
However, I had terrible luck, as the typescript compiler in the project transpiles everything to commonJS and replaces the
import
withresolve,
which is a dead end. (At least after a few hours, I did not find a suitable workaround.)What is the reason for compiling with TypeScript to CommonJS and converting it via rollup to an ES module, anyway?
So, I am here asking for help or guidance on proceeding. Changing the overall compiling workflow and supplying a patch without asking would be a bad style.
The text was updated successfully, but these errors were encountered: