Hello. I don’t know if this is ok for this forum. But I have recently published my Three.js website, where I use EventEmitter.
I have implemented this with node.js (npm), and this works great. But now that I have launched the website, it does now work.
I get this error: “SyntaxError: Importing binding name ‘EventEmitter’ is not found.”
This is how I import EventEmitter:
import { EventEmitter } from "/node_modules/events/events.js"
I don’t know why this does not work, and I would really appreciate if someone could help. It is perhaps just something really obvious that I have missed.
This is how my folders are listed up. I am importing EventEmitter from resources.js.
Unfortunately not, that is how I wrote it in the beginning.
But then I get the following error:
“TypeError: Module specifier, ‘events’ does not start with “/”, “./”, or “…/”. Referenced from https://alexanderrubino.com/Experience/Utils/resources.js”
Therefore I changed it to the new code, since I had read some other forums. However, those questions where about importing THREE. Where I changed:
import * as THREE from 'three;
to
import * as THREE from '/node_modules/three/build/three.module.js';
So I figured I had to do the same with EventEmitter.
Can’t imagine circumstances under which this would be a good idea.
Quite literally just do npm create vite - then copy your stuff from experience and css to the src folder vite will create for you (and change imports back to normal - not the node_modules/... stuff.) You done in like 4-5 minutes - and you’ll save yourself quite a bit of headache in the future.
I believe I might have done something wrong at the very start.
After searching around, I found this link: Deploying a Static Site | Vite
Which states that you can launch website with help of command npm run build.
Currently I have set up my website using FileZilla, and treating it like a normal HTML, CSS and JavaScript website. Was I wrong for doing this?
And if I was, how do I deploy my site website onto the web? Since a lot of the tutorials are using Github Pages, which is not ideal since I have my own domain.