Problem in import ZapparThree

Hi
I download and test zapar sdk example and they worked ,but when I installed and then import on my project I faced with this error:

cameraTexture.js:9 Uncaught TypeError: Class extends value undefined is not a constructor or null
at ./node_modules/@zappar/zappar-threejs/lib/cameraTexture.js (cameraTexture.js:9:1)
at options.factory (react refresh:6:1)
at webpack_require (bootstrap:24:1)
at fn (hot module replacement:62:1)
at ./node_modules/@zappar/zappar-threejs/lib/camera.js (camera.js:7:1)
at options.factory (react refresh:6:1)
at webpack_require (bootstrap:24:1)
at fn (hot module replacement:62:1)
at ./node_modules/@zappar/zappar-threejs/lib/index.js (index.js:6:1)
at options.factory (react refresh:6:1)

Can you help me
And for ‘@zappar/imagetraining’ also I have problem with fs

1 Like

Same issue here. I’ve tried to make it work on a brand new create-react-app App, and when I try to import ZapparCanvas, the same error is returned by the browser’s console. Even if I use this:

import {} from "@zappar/zappar-react-three-fiber";

the same error is thrown.

I am using the following packages and versions:

  • node: 18.13.0 (also tried 16.13.0).
  • react: 18.2.0.
  • react-scripts: 5.0.1

Hi,

react-scripts@5 does not load .cjs by default. Following the instructions here will solve the undefined constructor issue.

@vira4.company, the imageTraining package runs on node as well as the browser. The default export being for node. That’s why you get fs issues. Please try importing from '@zappar/imagetraining/lib/web' if your application runs on the browser.

1 Like