1

I'm trying to make a simple demo application to use face-api. Line 2 of my code is throwing this error when I attempt to import the face-api.min.js file.

I've tried reformatting the import but I haven't been able to get it working.

//Importing Face Detection API
import faceapi from "./face-api.min.js";

Uncaught SyntaxError: Unexpected identifier

1 Answers1

2

As the package documentation says, the correct way to import it is

import * as faceapi from 'face-api.js';

EDIT: For usage in Node.js with CommonJS imports you can do:

const faceapi = require('face-api.js');
Clarity
  • 8,980
  • 2
  • 14
  • 29