I am currently experimenting with Angular and facing a challenge that I can't seem to figure out.
The issue I am encountering involves integrating a javascript code, SunLight.js, from the repository https://github.com/antarktikali/threejs-sunlight into my Angular project.
The SunLight.js file relies on THREE from Three.js. However, when I try to call the SunLight javascript object in my Typescript code, I receive an error stating that the THREE object is undefined. This problem is illustrated in the image below.
Can anyone provide guidance on how to allow SunLight.js to access the three module in my Angular project?
https://i.sstatic.net/vwBmt.jpg
Here is the setup I have:
I have included SunLight.js in a services folder
https://i.sstatic.net/krOH4.jpg
In angular.json, I have defined the script reference for SunLight.js
https://i.sstatic.net/FSUHP.jpg
In my Typescript file, I am using it as shown and it appears to recognize the SunLight object.
https://i.sstatic.net/6K9NK.jpg
https://i.sstatic.net/Y725J.jpg
https://i.sstatic.net/TVzF2.jpg
The SunLight.js code from the repository can be found here
(SunLight.js code snippet has been provided for reference)
Any assistance on this matter would be greatly appreciated. Thank you.