Closed juanRabaa closed 1 year ago
I have never tried importing in NextJS, but a react example (using npm install) is here: https://github.com/hiukim/mind-ar-js-react
Closing it for now, please re-open if problem persists.
It was a problem with how I was importing the library in next. Instead of doing a normal import, I had to disable server side rendering for the component that uses the library, which is activated by default.
Instead of
import ImageTrackingScene from 'COMPONENTS/ImageTrackingScene/ImageTrackingScene';
Do
import dynamic from 'next/dynamic';
const ImageTrackingScene = dynamic(() => import('COMPONENTS/ImageTrackingScene/ImageTrackingScene'), {
ssr: false,
});
Im following the Three.js installation guide with npm, and importing
mind-ar/dist/mindar-image-three.prod.js
throws aReferenceError
ReferenceError: require is not defined in ES module scope, you can use import instead This file is being treated as an ES module because it has a '.js' file extension and '[...]\node_modules\mind-ar\package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.