-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
Using obfuscated packages: Uncaught (in promise) TypeError: {......} is not a constructor #4680
Comments
The source code of Rollup CommonJS plugin can't work with obfuscated packages because it relies on static analysis to determine its exports. I don't know if it's possible to fix this incompatibility. If not, maybe we need to document it somewhere. |
@sodatea thanks for the response. |
Spent 8 hours until got here, I also use mediapipe but with vue and typescript. Are there any workarounds? @akhil-rana CDN example for <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script
src="https://cdn.jsdelivr.net/npm/@mediapipe/camera_utils/camera_utils.js"
crossorigin="anonymous"
></script>
<script
src="https://cdn.jsdelivr.net/npm/@mediapipe/selfie_segmentation/selfie_segmentation.js"
crossorigin="anonymous"
></script>
<title>Vite App</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html> |
@H6LS1S I'm not much familiar with vue but I was using this is vanilla typescript project. After spending many days I ended up making my own separate package using pure js and including that into my project. |
@akhil-rana Thanks for the advice, but I already solved my problems a little radically - I rebuilt everything on webpack ))) |
Found this thread after wasting several hours as well. Vanilla TypeScript setup. To save some time for others in the future, was getting a similar error: |
Also have this issue, actually using Vite and React, but same issue. Unhandled Exception +0ms TypeError: Dm.FaceDetection is not a constructor putting this here to also help others when googling. |
I'm also using Vite, Reactjs, Mediapipe, React-three-js, and I got the following error after build: |
Note: The core issue of |
Does somebody have a workaround to get mediapipe working with vite? Thanks. |
Reading from the doc provided by @bluwy, I think the problem only occurs due to |
Yeah there has been discussion about that at #4921. It can be done but the whole bundling flow may need a big refactor. |
Describe the bug
I'm using vanilla ts project with a very basic structure here
I've imported the https://www.npmjs.com/package/@mediapipe/selfie_segmentation library like:
import { SelfieSegmentation } from '@mediapipe/selfie_segmentation';
When I'm in devepment mode, everything seems to work as intended but after build, I get this error:
Uncaught (in promise) TypeError: e.SelfieSegmentation is not a constructor
I'm using chrome
Note:
Everything works fine in development mode by running
npm run dev
System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: