[SOLVED] Tween.js document is not defined

I am trying to get the tween.js working. In the documentation I read that I need to add tween.js to my project to get it working. However when I add it to my project I get this error: “Uncaught ReferenceError: document is not defined”.

What am I doing wrong? I used it from this github. https://github.com/playcanvas/playcanvas-tween

That’s fine, it’s not meant to be parsed as it’s not a PlayCanvas script type.

But if I add the script to my project and do nothing and just click Launch

I get all these errors.

Hmm, I’ve just added the tween.js file from GitHub into a new project with no issues when launching :thinking:

Can you share a public project with this issue please?

Ok that is strange. I will check it out with a new project.

Very weird. I created a new project and still get the error.

Can you share the new project please?

I just noticed that your tween.js file is 4KB, are you using the file here?

I think you’ve accidentally downloaded the tween test JS file instead of the actual tween library, hence it’s only 4K instead of 20KB. I’ve made a PR to make this more obvious in the repo.

1 Like

thank you! That was the problem indeed.

I had to download the github files via Github Desktop instead of downloading it as a zip file.
It works nows.