aws-samples / amazon-sumerian-hosts

Amazon Sumerian Hosts (Hosts) is an experimental open source project that aims to make it easy to create interactive animated 3D characters for Babylon.js, three.js, and other web 3D frameworks. It leverages AWS services including Amazon Polly (text-to-speech) and Amazon Lex (chatbot).
MIT No Attribution
183 stars 82 forks source link

Issue importing Three.js #67

Closed charles-hay closed 2 years ago

charles-hay commented 2 years ago

When I try to run the project I get the error

Uncaught TypeError: Failed to resolve module specifier "three". Relative references must start with either "/", "./", or "../".
rowedn commented 2 years ago

Hi charles-hay,

Can you provide us with some extra information for how you're building and running the project? Specifically we'd like to know:

If you could link us to whatever code you've written in your project that would be helpful as well.

charles-hay commented 2 years ago

I was using Github Pages to run it when I changed the imports of OrbitControls and GLTFLoader to a local reference instead of a CDN it worked

dcoder4 commented 2 years ago

I get this same error when running the three.js demo out-of-the-box. Why? Dont get any issues with the babylon.js version. @charles-hay when you say you changed the imports to local reference what did you actually do to make work?

charles-hay commented 2 years ago

@dcoder4 so when you import GLTFLoader and OrbitControls it pulls from the CDN. Three.js doesn't like the import using a non-relative reference like ./, /, or ../ so I copied the raw code for those files from here and here put it somewhere else in the repo and referenced it as a local reference. This is definitely not the most elegant solution but it works 🤷

rowedn commented 2 years ago

I'm going to reopen this. I can reproduce this locally and I think this is an issue for everyone.

charles-hay commented 2 years ago

@rowedn Did my suggestion not work or do you just want it fixed in the main repo?

rowedn commented 2 years ago

@charles-hay We want it fixed in the main repo. Thanks for bringing this to our attention!

charles-hay commented 2 years ago

@rowedn I just made that PR. idk if you want to use that implementation or not. tbh it's not the best

rowedn commented 2 years ago

Looks like this was broken by a recent change to the version of three.js on the CDN: https://github.com/mrdoob/three.js/commit/eadd35e44c49eee5b3910cd2b761fbdfd05d6c67#diff-4728538b2d7d2a8298b8ac8ded9eafbe6e8515961e5b339e56cd3e47d40d3b49

We're working on a fix right now.

charles-hay commented 2 years ago

So should I close my PR? #69

brhook-aws commented 2 years ago

@charles-hay yes, you can close the PR. We may use it as a reference for the change we are making. Once the issue has been resolved and pushed, we'll close out this issue. Apologies for the inconvenience.

rahulss14 commented 2 years ago

Another workaround is to change versions of threejs , GLTFLoader and OrbitControls .

charles-hay commented 2 years ago

@rahulss14 that would make sense since the update is what broke it. Big 🧠

brhook-aws commented 2 years ago

We've merged in the change for the fix on this issue, which changes the CDN to a version one that should work. Please re-open the issue if you continue to experience issues.

charles-hay commented 2 years ago

Thanks @brhook-aws