Since my index.html file is not in the root directory, I added a netlify.toml file to tell netlify where index.html is, but I’m not sure if that is messing this up.
Here is my code:
The site works fine locally, but not here or on GitHub pages. I’m also not sure if this uses Vite, as I cannot find a vite.config file.
@CalixH The structure of the repo seems a little unnecessary, since you’ve got three.js in a package.json at the root of the repo, and then all the other build dependencies in a package.json inside the CalixHuangSite folder.
As your build is being performed with vite and you have no other config, the default folder for the output of npm run build is CalixHuangSite/dist/, and that is all that you would need to have deployed by Netlify.
So to simplify things (and get it working), I would just…
Add the three.js dependency to the package.json in CalixHuangSite/
Remove the package.json and package-lock.json from the root
Copy all the files & folders from CalixHuangSite/ to the root
Delete the CalixHuangSite/ folder
Run npm install in the root to ensure everything is in place
Adjust the netlify.toml to…
publish = "dist/"
command = "npm run build"
Change the imports in your main.js file so they no longer reference ../node_modules/
I may have missed some steps, but the basic idea is to get your site running in the root, with all your dependencies in the same spot, and keep it simple.
Thanks for your reply, the website is working now!
Thank you so much! The last issue I have to figure out now is why the video won’t play…