hiukim / mind-ar-js

Web Augmented Reality. Image Tracking, Face Tracking. Tensorflow.js
MIT License
2.19k stars 407 forks source link

Error with FaceMesh demo using import: Module is not defined #240

Closed etekweb closed 1 year ago

etekweb commented 2 years ago

When adapting the MindAR Three.js FaceMesh demo for a Vue.js project (importing with npm), I receive the following error upon importing the script:

Uncaught ReferenceError: Module is not defined
    at Object.<anonymous> (mindar-face-three.prod.js:2:2703852)
    at 129 (mindar-face-three.prod.js:2:2703883)
    at g (mindar-face-three.prod.js:2:2705228)
    at 9487 (mindar-face-three.prod.js:2:737553)
    at g (mindar-face-three.prod.js:2:2705228)
    at 1320 (mindar-face-three.prod.js:2:695341)
    at g (mindar-face-three.prod.js:2:2705228)
    at mindar-face-three.prod.js:2:2705890
    at mindar-face-three.prod.js:2:2710478
    at node_modules/mind-ar/dist/mindar-face-three.prod.js (mindar-face-three.prod.js:2:2710482)
My code (click to reveal) ``` ```

I do not have this issue when using similar import statements for the MindAR image detection demo.

Is there something I am missing with this one?

etekweb commented 2 years ago

I have dug into this issue further and it appears to be related to the MindAR project being written in CommonJS instead of ESM. I am still investigating what can be done to work around this issue.

hiukim commented 2 years ago

Definitely would love to make it ESM compatible.

We have an issue hanging for a while. https://github.com/hiukim/mind-ar-js/issues/63 If you have any inputs or would like to create a PR