Can someone please help me understand the proper way to import and utilize the three.js library in a vue component?
Despite my extensive research, it seems that most individuals use the following code line to import three.js into a vue component. However, I suspect this method is outdated, intended for older versions of three.js or earlier vue versions.
import * as THREE from './js/three.js';
Unfortunately, this approach does not seem to work for me as I encounter warnings when compiling my vue project. In fact, my project fails to compile correctly, resulting in an empty file when accessed. https://i.sstatic.net/Hlv3t.png
I have attempted several other common methods of importing three.js with no success!
Although I am not well-versed in Vue, I noticed that three.js includes a block of code with exports. This may impact how I should import the library to avoid compilation warnings.
exports.WebGLRenderTargetCube = WebGLRenderTargetCube;
exports.WebGLRenderTarget = WebGLRenderTarget;
exports.WebGLRenderer = WebGLRenderer;
exports.ShaderLib = ShaderLib;
exports.UniformsLib = UniformsLib;
exports.UniformsUtils = UniformsUtils;
exports.ShaderChunk = ShaderChunk;
exports.FogExp2 = FogExp2;
exports.Fog = Fog;
exports.Scene = Scene;
(and so on...)
Link to the complete Vue component file I am using for my project.