I have two questions.
(1) Why do I have to include both Three.js and three.min.js. Doesn’t Three.js contain everything that I need? When I don’t have both together, I get errors.
(2) A custom javascript file (non-module) uses LineMaterial and I get an error indicating that LineMaterial is not defined. Here is how LineMaterial is included:
<script src="js/src/Three.js" type="module"></script>
<script src="js/three.min.js"></script>
<script src="js/src/LineSegmentsGeometry.js" type="module" ></script>
<script src="js/src/LineGeometry.js" type="module"></script>
<script src="js/src/Line2.js" type="module"></script>
<script src="js/src/LineSegments2.js" type="module"></script>
<script src="js/three.projector.js"></script>
<script src="js/Detector.js"></script>
<script src="js/OrbitControls.js"></script>
No, you need only one of them. three.min.js is just the minified version of three.js. What errors do you get?
If you include the non-module version of LineMaterial, the class is only available in the THREE namespace.
Where can I obtain non-module version of LineSegments2, LineMaterial, …
The error that I get when I remove three.min.js:
From the examples/js directory.
That helped but I get an error that says LineMaterial is not a constructor. Here is how it is being used:
var matLine = new THREE.LineMaterial( {
color: 0xffffff,
linewidth: 5, // in pixels
vertexColors: true,
//resolution: // to be set by renderer, eventually
dashed: false
} );
According to your imports, you have not yet imported LineMaterial yet.
BTW: If you are importing non-module files via the script tag, type="module" is not necessary.