AR-js-org / AR.js

Image tracking, Location Based AR, Marker tracking. All on the Web.
MIT License
5.3k stars 909 forks source link

Module Import fails in Nuxt3 --- ar-threex-location-only.js --- Cannot read properties of undefined (reading 'THREE') #588

Open dennishelbig opened 7 months ago

dennishelbig commented 7 months ago

Do you want to request a feature or report a bug? It's a bug

What is the current behavior? Was trying to replicate this example: https://ar-js-org.github.io/AR.js-Docs/location-based-three/part1/

Import fails when importing 'three.js' and '~/node_modules/@ar-js-org/ar.js/three.js/build/ar-threex-location-only.js'

If the current behavior is a bug, please provide the steps to reproduce. https://codesandbox.io/p/devbox/ar-js-forked-fmnfnh?file=%2Fapp.vue%3A7%2C73-7%2C99 See Console --> Cannot read properties of undefined (reading 'THREE')

Please mention other relevant information such as the browser version, Operating System and Device Name

Mac OSX 14.1 Chromium, Safari Nuxt 3 @ar-js-org/ar.js Module from npm

What is the expected behavior? Module import should run through without errors.

If this is a feature request, what is motivation or use case for changing the behavior?

roiLeo commented 7 months ago

Have you tried to setup project using Tresjs?

dennishelbig commented 6 months ago

No, I didn't.

I kind of figured out that while time of writing the issue, I tried three v0.159 (current latest version) and arjs v3.4.5, which are not compatible with each other. After seeing the article I used to build upon was written around a year ago, I took a three.js version from that time. v0.147 works with arjs v3.4.5.

Thanks the hinting tresjs, wasn't aware of it, I'll take a look at it.