Closed DaiHaoguang3151 closed 8 months ago
this looks like import error - like what happens if browser lib is getting imported server side.
i have no idea what your environment is like, but the fact you're using process.env
makes me believe its an SSR style setup.
in which case, you need to lazy-import library in browser-only as using global import will make SSR try to bake it into bundle and that is never going to work.
`import React, { useState, useRef } from "react"; import as faceapi from 'face-api.js' import as tf from '@tensorflow/tfjs-core'; import { setWasmPaths } from "@tensorflow/tfjs-backend-wasm";
const App = () => { const [session, setSession] = useState(null); const [loading, setLoading] = useState("Loading OpenCV.js...");
};
export default App;`
"dependencies": { "@tensorflow/tfjs": "^4.15.0", "@tensorflow/tfjs-backend-wasm": "^4.15.0", "@testing-library/jest-dom": "^5.14.1", "@testing-library/react": "^13.0.0", "@testing-library/user-event": "^13.2.1", "face-api.js": "^0.22.2", "onnxruntime-web": "^1.11.0", "react": "^18.1.0", "react-dom": "^18.1.0", "react-scripts": "5.0.1", "web-vitals": "^2.1.0" },
I encountered the following issue while executing the above code