I’m trying to use Mediapipe for javascript in a project. There is an example below by the MediaPipe authors.
https://codepen.io/mediapipe-preview/pen/OJBVQJm
However, when I try this code and host it locally in vscode it gives me an error:
Uncaught SyntaxError: Cannot use import statement outside a module. This references the first line in the js file. Vision is used on the following line.
import vision from "https://cdn.jsdelivr.net/npm/@mediapipe/[email protected]";
const { FaceLandmarker, FilesetResolver, DrawingUtils } = vision;
In the html file I’ve changed the links for the script and style files. Anyone know what is going wrong?
I have seen several ways to import vision however I’m still doing it wrong. Here is a setup guide:
https://ai.google.dev/edge/mediapipe/solutions/setup_web