I am trying to implement Three.js in node as I want my code to be on the server-side and not visible to the client. This is my code currently that I am using:
const THREE = requires('three');
const STLLoader = import('three/examples/jsm/loaders/STLLoader.js');
I am able to call the modules using import() as I have installed the esm module using
npm i esm
I am currently running the code using the command nodemon -r esm app.js
Yet even after importing the STLLoader separately from the jsm folder I get the error:
TypeError: STLLoader is not a constructor
I have searched a lot but couldn’t find any answer.