(Posting this here because stackoverflow seemed to not have the answer, maybe because of the specifity of the environment.)
Does anyone have problems with using ES6 Imports in three.js? this is without Webpack or Babel, but nodes inbuilt functionality in Node 12’s experimental features or 14. Is it recommended i just don’t use node with es6 imports atm?
I cant access three as a module for example, to import external controls, loaders etc. //import {OrbitControls} from "three/examples/jsm/controls/OrbitControls.js";
It tells me failed to load resource
Relative references must start with either “/”, “./”, or “…/”.
But if I were to use relative imports either import {OrbitControls} from "../../node_modules/three/examples/jsm/controls/OrbitControls.js";
it is not found. (404 Error).
Even when I were to paste it into the js folder (which surely defeats the point of the threejs npm module?) there are mutiple imports inside the OrbitControls.js inside the jsm folder. so i receive a
GET http://localhost:5000/build/three.module.js net::ERR_ABORTED 404 (Not Found)
error inside OrbitControls.js line 18.
Also, my script file for index.js is indeed set to “type: module” in the html.
I really apologise if this question sounds ranty, its just that Ive asked and answered this question before and I want to cover everything so that I can understand what is going on. Thanks vm.
also here is my folder structure